diff options
author | Ben McGinnes <[email protected]> | 2018-08-13 16:48:38 +0000 |
---|---|---|
committer | Ben McGinnes <[email protected]> | 2018-08-13 16:48:38 +0000 |
commit | a256d84882616341b3f357340533893a1db8b5c1 (patch) | |
tree | c971d82836e9d625254cec457ccdf46ff4da7dcd /lang/python/examples/howto/symcrypt-file.py | |
parent | Symmetric encryption example. (diff) | |
download | gpgme-a256d84882616341b3f357340533893a1db8b5c1.tar.gz gpgme-a256d84882616341b3f357340533893a1db8b5c1.zip |
Symmetric encryption example
* lang/python/examples/howto/symcrypt-file.py: Fixed the error code
and the passphrase key word arg.
Diffstat (limited to 'lang/python/examples/howto/symcrypt-file.py')
-rwxr-xr-x | lang/python/examples/howto/symcrypt-file.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lang/python/examples/howto/symcrypt-file.py b/lang/python/examples/howto/symcrypt-file.py index 2b242845..2e6ece4b 100755 --- a/lang/python/examples/howto/symcrypt-file.py +++ b/lang/python/examples/howto/symcrypt-file.py @@ -46,18 +46,18 @@ with open(filename, "rb") as f: with gpg.Context(armor=True) as ca: try: - ciphertext, result, sign_result = ca.encrypt(text, passphrase=None, + ciphertext, result, sign_result = ca.encrypt(text, passphrase=True, sign=False) with open("{0}.asc".format(filename), "wb") as fa: fa.write(ciphertext) - except gpg.errors.InvalidRecipients as e: + except gpg.errors.GPGMEError as e: print(e) with gpg.Context() as cg: try: - ciphertext, result, sign_result = cg.encrypt(text, passphrase=None, + ciphertext, result, sign_result = cg.encrypt(text, passphrase=True, sign=False) with open("{0}.gpg".format(filename), "wb") as fg: fg.write(ciphertext) - except gpg.errors.InvalidRecipients as e: + except gpg.errors.GPGMEError as e: print(e) |