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,12 +115,32 @@ for i in range(len(lines)):
defkey_fpr = dline.split(":")[-1].replace('"', '').split(',')[0].upper() defkey_fpr = dline.split(":")[-1].replace('"', '').split(',')[0].upper()
enckey_fpr = eline.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: if sigkey is not None:
mykey = c.keylist(pattern=sigkey) mykey = c.keylist(pattern=sigkey, secret=True)
mk = list(mykey) mk = list(mykey)
mkfpr = mk[0].fpr.upper() mkfpr = mk[0].fpr.upper()
c.signers = mk
else: else:
pass if dk is None and ek is not None:
c.signers = ek
else:
pass
for group in group_lists: for group in group_lists:
if group[0] == clique: if group[0] == clique: