diff options
author | Ben McGinnes <[email protected]> | 2018-09-27 13:23:37 +0000 |
---|---|---|
committer | Ben McGinnes <[email protected]> | 2018-09-27 13:23:37 +0000 |
commit | ce045a1ef9c63042fcffb5487b19646d67addba0 (patch) | |
tree | 0f67fd385854af9f75621532367e7d7cba34bf83 /lang/python/examples/howto/local-sign-group.py | |
parent | example: python bindings (diff) | |
download | gpgme-ce045a1ef9c63042fcffb5487b19646d67addba0.tar.gz gpgme-ce045a1ef9c63042fcffb5487b19646d67addba0.zip |
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 <[email protected]>
Diffstat (limited to 'lang/python/examples/howto/local-sign-group.py')
-rwxr-xr-x | lang/python/examples/howto/local-sign-group.py | 24 |
1 files 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: |