diff options
| author | J08nY | 2017-08-18 16:48:46 +0200 |
|---|---|---|
| committer | J08nY | 2017-08-18 16:48:46 +0200 |
| commit | 680ae1be88d22f2eb5d6f16a58acda4e5927ed72 (patch) | |
| tree | 9e2d3c2cc3ddabcfbfba3563a17106629a5c8e0f /src/mailman_pgp/commands/eml_key.py | |
| parent | 86c2979281d4d87bc55b5203b064af12ec3795c2 (diff) | |
| download | mailman-pgp-680ae1be88d22f2eb5d6f16a58acda4e5927ed72.tar.gz mailman-pgp-680ae1be88d22f2eb5d6f16a58acda4e5927ed72.tar.zst mailman-pgp-680ae1be88d22f2eb5d6f16a58acda4e5927ed72.zip | |
Diffstat (limited to 'src/mailman_pgp/commands/eml_key.py')
| -rw-r--r-- | src/mailman_pgp/commands/eml_key.py | 41 |
1 files changed, 5 insertions, 36 deletions
diff --git a/src/mailman_pgp/commands/eml_key.py b/src/mailman_pgp/commands/eml_key.py index 29fa99c..97a1a6f 100644 --- a/src/mailman_pgp/commands/eml_key.py +++ b/src/mailman_pgp/commands/eml_key.py @@ -39,7 +39,7 @@ from mailman_pgp.model.list import PGPMailingList from mailman_pgp.pgp.mime import MIMEWrapper from mailman_pgp.pgp.wrapper import PGPWrapper from mailman_pgp.utils.email import get_email -from mailman_pgp.utils.pgp import key_usable +from mailman_pgp.utils.pgp import key_merge, key_usable from mailman_pgp.workflows.key_change import (CHANGE_CONFIRM_REQUEST, KeyChangeModWorkflow, KeyChangeWorkflow) @@ -411,43 +411,12 @@ def _cmd_sign(pgp_list, mlist, msg, msgdata, arguments, results): print('You are not allowed to sign the list key.', file=results) return ContinueProcessing.no - if pgp_list.pubkey.key_material != key.key_material: - print('You sent a wrong key.', file=results) + try: + key_merge(pgp_list.key, key, pgp_address.key) + except ValueError as e: + print(str(e), file=results) return ContinueProcessing.no - uid_map = {} - for uid in pgp_list.key.userids: - for uid_other in key.userids: - if uid == uid_other: - uid_map[uid] = uid_other - - if len(uid_map) == 0: - print('No signed UIDs found.', file=results) - return ContinueProcessing.no - - uid_sigs = {} - for uid, uid_other in uid_map.items(): - for sig in uid_other.signatures: - if sig in uid.signatures: - continue - if sig.signer != pgp_address.key.fingerprint.keyid: - continue - # sig is a new signature, not currenctly on uid, ans seems to - # be made by the pgp_address.key - try: - verification = pgp_address.key.verify(uid, sig) - if bool(verification): - uid_sigs.setdefault(uid, []).append(sig) - except PGPError: - pass - - if len(uid_sigs) == 0: - print('No new certifications found.', file=results) - return ContinueProcessing.no - - for uid, sigs in uid_sigs.items(): - for sig in sigs: - uid |= sig pgp_list.fs_key.save() print('List key updated with new signatures.', file=results) |
