docs: python bindings howto
* Another attempt at fixing the org-mode version. * A proof reader ascertained there were tabs in it instead of whitespace. * Stripped the lot out and replaced with standard 4 spaces, fixed every incorrect example ... and it still breaks upon save and/or export. * Added the reference to the mutt-groups.py script to demonstrate the groups.py module/code.
This commit is contained in:
parent
e144a6d706
commit
897423422b
@ -537,7 +537,8 @@
|
|||||||
c = gpg.Context(armor=True)
|
c = gpg.Context(armor=True)
|
||||||
rkey = list(c.keylist(pattern=a_key, secret=False))
|
rkey = list(c.keylist(pattern=a_key, secret=False))
|
||||||
ciphertext, result, sign_result = c.encrypt(text, recipients=rkey,
|
ciphertext, result, sign_result = c.encrypt(text, recipients=rkey,
|
||||||
sign=True, always_trust=True, add_encrypt_to=True)
|
sign=True, always_trust=True,
|
||||||
|
add_encrypt_to=True)
|
||||||
|
|
||||||
with open("secret_plans.txt.asc", "wb") as afile:
|
with open("secret_plans.txt.asc", "wb") as afile:
|
||||||
afile.write(ciphertext)
|
afile.write(ciphertext)
|
||||||
@ -587,8 +588,8 @@
|
|||||||
if rpattern[i].can_encrypt == 1:
|
if rpattern[i].can_encrypt == 1:
|
||||||
logrus.append(rpattern[i])
|
logrus.append(rpattern[i])
|
||||||
|
|
||||||
ciphertext, result, sign_result = c.encrypt(text, recipients=logrus, sign=False,
|
ciphertext, result, sign_result = c.encrypt(text, recipients=logrus,
|
||||||
always_trust=True)
|
sign=False, always_trust=True)
|
||||||
|
|
||||||
with open("secret_plans.txt.asc", "wb") as afile:
|
with open("secret_plans.txt.asc", "wb") as afile:
|
||||||
afile.write(ciphertext)
|
afile.write(ciphertext)
|
||||||
@ -638,14 +639,14 @@
|
|||||||
logrus.remove(logrus[n])
|
logrus.remove(logrus[n])
|
||||||
else:
|
else:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
try:
|
try:
|
||||||
ciphertext, result, sign_result = c.encrypt(text, recipients=logrus,
|
ciphertext, result, sign_result = c.encrypt(text, recipients=logrus,
|
||||||
add_encrypt_to=True)
|
add_encrypt_to=True)
|
||||||
except:
|
|
||||||
pass
|
|
||||||
|
|
||||||
with open("secret_plans.txt.asc", "wb") as afile:
|
with open("secret_plans.txt.asc", "wb") as afile:
|
||||||
afile.write(ciphertext)
|
afile.write(ciphertext)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
This will attempt to encrypt to all the keys searched for, then
|
This will attempt to encrypt to all the keys searched for, then
|
||||||
@ -906,8 +907,8 @@
|
|||||||
{0}
|
{0}
|
||||||
with key {1}
|
with key {1}
|
||||||
made at {2}
|
made at {2}
|
||||||
""".format(c.get_key(sign.fpr).uids[0].uid,
|
""".format(c.get_key(sign.fpr).uids[0].uid, sign.fpr,
|
||||||
sign.fpr, time.ctime(sign.timestamp)))
|
time.ctime(sign.timestamp)))
|
||||||
else:
|
else:
|
||||||
pass
|
pass
|
||||||
#+end_src
|
#+end_src
|
||||||
@ -938,8 +939,8 @@
|
|||||||
{0}
|
{0}
|
||||||
with key {1}
|
with key {1}
|
||||||
made at {2}
|
made at {2}
|
||||||
""".format(c.get_key(sign.fpr).uids[0].uid,
|
""".format(c.get_key(sign.fpr).uids[0].uid, sign.fpr,
|
||||||
sign.fpr, time.ctime(sign.timestamp)))
|
time.ctime(sign.timestamp)))
|
||||||
else:
|
else:
|
||||||
pass
|
pass
|
||||||
#+end_src
|
#+end_src
|
||||||
@ -987,8 +988,8 @@
|
|||||||
{0}
|
{0}
|
||||||
with key {1}
|
with key {1}
|
||||||
made at {2}
|
made at {2}
|
||||||
""".format(c.get_key(sign.fpr).uids[0].uid,
|
""".format(c.get_key(sign.fpr).uids[0].uid, sign.fpr,
|
||||||
sign.fpr, time.ctime(sign.timestamp)))
|
time.ctime(sign.timestamp)))
|
||||||
else:
|
else:
|
||||||
pass
|
pass
|
||||||
#+end_src
|
#+end_src
|
||||||
@ -1009,15 +1010,15 @@
|
|||||||
verified = False
|
verified = False
|
||||||
print(e)
|
print(e)
|
||||||
|
|
||||||
if verified is not None:
|
if verified is True:
|
||||||
for i in range(len(result.signatures)):
|
for i in range(len(result.signatures)):
|
||||||
sign = result.signatures[i]
|
sign = result.signatures[i]
|
||||||
print("""Good signature from:
|
print("""Good signature from:
|
||||||
{0}
|
{0}
|
||||||
with key {1}
|
with key {1}
|
||||||
made at {2}
|
made at {2}
|
||||||
""".format(c.get_key(sign.fpr).uids[0].uid,
|
""".format(c.get_key(sign.fpr).uids[0].uid, sign.fpr,
|
||||||
sign.fpr, time.ctime(sign.timestamp)))
|
time.ctime(sign.timestamp)))
|
||||||
else:
|
else:
|
||||||
pass
|
pass
|
||||||
#+end_src
|
#+end_src
|
||||||
@ -1372,6 +1373,12 @@
|
|||||||
=group_lines[i][0]= as the name of the group, but
|
=group_lines[i][0]= as the name of the group, but
|
||||||
=group_lists[i][1]= is the key IDs of the group as a string.
|
=group_lists[i][1]= is the key IDs of the group as a string.
|
||||||
|
|
||||||
|
A demonstration of using the =groups.py= module is also available
|
||||||
|
in the form of the executable =mutt-groups.py= script. This second
|
||||||
|
script reads all the group entries in a user's =gpg.conf= file and
|
||||||
|
converts them into crypt-hooks suitable for use with the Mutt and
|
||||||
|
Neomutt mail clients.
|
||||||
|
|
||||||
|
|
||||||
* Copyright and Licensing
|
* Copyright and Licensing
|
||||||
:PROPERTIES:
|
:PROPERTIES:
|
||||||
|
Loading…
Reference in New Issue
Block a user