aboutsummaryrefslogtreecommitdiffstats
path: root/lang/python/docs/GPGMEpythonHOWTOen.org
diff options
context:
space:
mode:
authorMaximilian Krambach <[email protected]>2018-05-24 12:03:09 +0000
committerMaximilian Krambach <[email protected]>2018-05-24 12:03:09 +0000
commite38b8beb20a8cfe897c378e3c20be80b8256159e (patch)
tree2b95b796bcc609fedc20197de866a28aef20f554 /lang/python/docs/GPGMEpythonHOWTOen.org
parentjs: remove openpgp mode (diff)
parentjson: Put signature info before data output (diff)
downloadgpgme-e38b8beb20a8cfe897c378e3c20be80b8256159e.tar.gz
gpgme-e38b8beb20a8cfe897c378e3c20be80b8256159e.zip
Merge branch 'master' into javascript-binding
Diffstat (limited to 'lang/python/docs/GPGMEpythonHOWTOen.org')
-rw-r--r--lang/python/docs/GPGMEpythonHOWTOen.org17
1 files changed, 12 insertions, 5 deletions
diff --git a/lang/python/docs/GPGMEpythonHOWTOen.org b/lang/python/docs/GPGMEpythonHOWTOen.org
index cb85b61b..ef66effc 100644
--- a/lang/python/docs/GPGMEpythonHOWTOen.org
+++ b/lang/python/docs/GPGMEpythonHOWTOen.org
@@ -14,7 +14,7 @@
:CUSTOM_ID: intro
:END:
- | Version: | 0.1.0 |
+ | Version: | 0.1.1 |
| Author: | Ben McGinnes <[email protected]> |
| Author GPG Key: | DB4724E6FA4286C92B4E55C4321E4E2373590E5D |
| Language: | Australian English, British English |
@@ -673,10 +673,17 @@
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)
+ try:
+ plaintext, result, verify_result = gpg.Context().decrypt(cfile)
+ except gpg.errors.GPGMEError as e:
+ plaintext = None
+ print(e)
+
+ if plaintext is not None:
+ with open(newfile, "wb") as nfile:
+ nfile.write(plaintext)
+ else:
+ pass
#+end_src
The data available in =plaintext= in this example is the decrypted