[git] GPGME - branch, ben/docs/2018-03, updated. gpgme-1.10.0-75-g484e9a6

by Ben McGinnes cvs at cvs.gnupg.org
Mon Mar 12 21:44:49 CET 2018


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GnuPG Made Easy".

The branch, ben/docs/2018-03 has been updated
       via  484e9a6229ac9c80c6be4df638bce711f08a74c6 (commit)
      from  a8f48b6f577d562c25fd0191c0cc2cc8e96078c1 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 484e9a6229ac9c80c6be4df638bce711f08a74c6
Author: Ben McGinnes <ben at adversary.org>
Date:   Tue Mar 13 07:42:04 2018 +1100

    doc: python bindings howto
    
    * updated multi-encryption final example to be complete.
    * second example shows most likely method of reading plaintext.
    * updated example filenames to stick with running gag
      (i.e. secret_plans.txt).

diff --git a/lang/python/docs/GPGMEpythonHOWTOen.org b/lang/python/docs/GPGMEpythonHOWTOen.org
index 46bd231..622475f 100644
--- a/lang/python/docs/GPGMEpythonHOWTOen.org
+++ b/lang/python/docs/GPGMEpythonHOWTOen.org
@@ -384,7 +384,7 @@
 
       cipher = c.encrypt(text, recipients=rlogrus, sign=False, always_trust=True)
 
-      afile = open("encrypted_file.txt.asc", "wb")
+      afile = open("secret_plans.txt.asc", "wb")
       afile.write(cipher[0])
       afile.close()
     #+end_src
@@ -409,6 +409,20 @@
     somewhat with something more like this:
 
     #+begin_src python
+      import gpg
+
+      afile = open("secret_plans.txt", "rb")
+      text = afile.read()
+      afile.close()
+
+      c = gpg.Context(armor=True)
+      rpattern = list(c.keylist(pattern="@gnupg.org", secret=False))
+      rlogrus = []
+
+      for i in range(len(rpattern)):
+	  if rpattern[i].can_encrypt == 1:
+	      rlogrus.append(rpattern[i])
+
       try:
 	  cipher = c.encrypt(text, recipients=rlogrus, add_encrypt_to=True)
       except gpg.errors.InvalidRecipients as e:
@@ -422,6 +436,10 @@
 	      cipher = c.encrypt(text, recipients=rlogrus, add_encrypt_to=True)
 	  except:
 	      pass
+
+      afile = open("secret_plans.txt.asc", "wb")
+      afile.write(cipher[0])
+      afile.close()
     #+end_src
 
     This will attempt to encrypt to all the keys searched for, then

-----------------------------------------------------------------------

Summary of changes:
 lang/python/docs/GPGMEpythonHOWTOen.org | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)


hooks/post-receive
-- 
GnuPG Made Easy
http://git.gnupg.org




More information about the Gnupg-commits mailing list