Symmetric example

* lang/python/examples/howto/symcrypt-file.py: *sigh*; passphrase was
  right the first time, just the error check that wasn't.
* I really should stop second guessing myself one of these days ...

Signed-off-by: Ben McGinnes <ben@adversary.org>
This commit is contained in:
Ben McGinnes 2018-08-14 02:55:56 +10:00
parent a256d84882
commit 279cac0ffb

View File

@ -46,7 +46,7 @@ with open(filename, "rb") as f:
with gpg.Context(armor=True) as ca: with gpg.Context(armor=True) as ca:
try: try:
ciphertext, result, sign_result = ca.encrypt(text, passphrase=True, ciphertext, result, sign_result = ca.encrypt(text, passphrase=None,
sign=False) sign=False)
with open("{0}.asc".format(filename), "wb") as fa: with open("{0}.asc".format(filename), "wb") as fa:
fa.write(ciphertext) fa.write(ciphertext)
@ -55,7 +55,7 @@ with gpg.Context(armor=True) as ca:
with gpg.Context() as cg: with gpg.Context() as cg:
try: try:
ciphertext, result, sign_result = cg.encrypt(text, passphrase=True, ciphertext, result, sign_result = cg.encrypt(text, passphrase=None,
sign=False) sign=False)
with open("{0}.gpg".format(filename), "wb") as fg: with open("{0}.gpg".format(filename), "wb") as fg:
fg.write(ciphertext) fg.write(ciphertext)