From 732bb17fc517427acd55d5aa156b1458ff679629 Mon Sep 17 00:00:00 2001 From: Jan Dittberner Date: Tue, 10 Jul 2007 15:50:25 +0000 Subject: [PATCH] - always encrypt if we have a key git-svn-id: file:///home/www/usr01/svn/gnuviechadmin/gnuviech.info/gnuviechadmin/trunk@232 a67ec6bc-e5d5-0310-a910-815c51eb3124 --- gnuviechadmin/backend/BackendEntity.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/gnuviechadmin/backend/BackendEntity.py b/gnuviechadmin/backend/BackendEntity.py index 06a02e4..291f625 100644 --- a/gnuviechadmin/backend/BackendEntity.py +++ b/gnuviechadmin/backend/BackendEntity.py @@ -71,8 +71,9 @@ class BackendEntity(object): and signs it usign GnuPG. If a public key of the recipient is available the mail is encrypted.""" plain = core.Data(text) - sig = core.Data() + cipher = core.Data() c = core.Context() + c.set_armor(1) signer = config.get('common', 'mailfrom') rcpt = config.get('common', 'mailto') c.signers_clear() @@ -83,7 +84,7 @@ class BackendEntity(object): raise Exception("No secret keys for signing available for %s." % ( signer)) keylist = [] - for key in [x for x in c.op_keylist_all(rcpt, 1)]: + for key in c.op_keylist_all(rcpt, 0): valid = 0 subkey = key.subkeys while subkey: @@ -96,13 +97,12 @@ class BackendEntity(object): if valid: keylist.append(key) if keylist: - c.set_armor(1) - c.op_encrypt_sign(keylist, 1, plain, sig) + c.op_encrypt_sign(keylist, 1, plain, cipher) else: - c.op_sign(plain, sig, mode.CLEAR) - sig.seek(0,0) + c.op_sign(plain, cipher, mode.CLEAR) + cipher.seek(0,0) - msg = MIMEText(sig.read()) + msg = MIMEText(cipher.read()) msg['Subject'] = subject msg['From'] = signer msg['To'] = rcpt