From ce045a1ef9c63042fcffb5487b19646d67addba0 Mon Sep 17 00:00:00 2001 From: Ben McGinnes Date: Thu, 27 Sep 2018 23:23:37 +1000 Subject: [PATCH] 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 --- .../python/examples/howto/local-sign-group.py | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/lang/python/examples/howto/local-sign-group.py b/lang/python/examples/howto/local-sign-group.py index 812042dd..0353646d 100755 --- a/lang/python/examples/howto/local-sign-group.py +++ b/lang/python/examples/howto/local-sign-group.py @@ -115,12 +115,32 @@ 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: - pass + if dk is None and ek is not None: + c.signers = ek + else: + pass for group in group_lists: if group[0] == clique: