example: local signatures

* lang/python/examples/howto/local-sign-group.py: added the bit where
  specifying the signing key is actually used for signing rather than
  just pruning the list of keys to certify.

Signed-off-by: Ben McGinnes <ben@adversary.org>
This commit is contained in:
Ben McGinnes 2018-09-27 23:23:37 +10:00
parent a047e0f68e
commit ce045a1ef9

View File

@ -115,11 +115,31 @@ for i in range(len(lines)):
defkey_fpr = dline.split(":")[-1].replace('"', '').split(',')[0].upper()
enckey_fpr = eline.split(":")[-1].replace('"', '').split(',')[0].upper()
try:
dkey = c.keylist(pattern=defkey_fpr, secret=True)
dk = list(dkey)
except Exception as de:
print(de)
dk = None
print("No valid default key.")
try:
ekey = c.keylist(pattern=defkey_fpr, secret=True)
ek = list(ekey)
except Exception as ee:
print(ee)
ek = None
print("No valid always encrypt to key.")
if sigkey is not None:
mykey = c.keylist(pattern=sigkey)
mykey = c.keylist(pattern=sigkey, secret=True)
mk = list(mykey)
mkfpr = mk[0].fpr.upper()
c.signers = mk
else:
if dk is None and ek is not None:
c.signers = ek
else:
pass
for group in group_lists: