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

by Ben McGinnes cvs at cvs.gnupg.org
Sun Mar 18 22:46:00 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  82c5af225f2bdf3acc6fc652a96ee61c9b057395 (commit)
      from  b549f69d0520bb74957b95cec9ea918dba2374f6 (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 82c5af225f2bdf3acc6fc652a96ee61c9b057395
Author: Ben McGinnes <ben at adversary.org>
Date:   Mon Mar 19 08:43:36 2018 +1100

    doc: python bindings howto
    
    * Stripped decryption example to the bare bones as suggested by Justus.

diff --git a/lang/python/docs/GPGMEpythonHOWTOen.org b/lang/python/docs/GPGMEpythonHOWTOen.org
index d27f562..a214423 100644
--- a/lang/python/docs/GPGMEpythonHOWTOen.org
+++ b/lang/python/docs/GPGMEpythonHOWTOen.org
@@ -690,28 +690,14 @@
    to =c= simply adds lines for no gain.
 
    #+begin_src python
-     import os.path
      import gpg
 
-     if os.path.exists("/path/to/secret_plans.txt.asc") is True:
-	 ciphertext = "/path/to/secret_plans.txt.asc"
-     elif os.path.exists("/path/to/secret_plans.txt.gpg") is True:
-	 ciphertext = "/path/to/secret_plans.txt.gpg"
-     else:
-	 ciphertext = None
-
-     if ciphertext is not None:
-	 afile = open(ciphertext, "rb")
-	 plaintext = gpg.Context().decrypt(afile)
-	 afile.close()
-	 newfile = open("/path/to/secret_plans.txt", "wb")
-	 newfile.write(plaintext[0])
-	 newfile.close()
-	 print(plaintext[0])
-	 plaintext[1]
-	 plaintext[2]
-     else:
-	 pass
+     ciphertext = input("Enter path and filename of encrypted file: ")
+     newfile = input("Enter path and filename of file to save decrypted data to: ")
+     with open(ciphertext, "rb") as cfile:
+         plaintext, result, verify_result = gpg.Context().decrypt(cfile)
+     with open(newfile, "wb" as nfile:
+         nfile.write(plaintext)
    #+end_src
 
    The data available in plaintext in this example is the decrypted

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

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


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




More information about the Gnupg-commits mailing list