diff options
| author | J08nY | 2017-08-02 01:26:57 +0200 |
|---|---|---|
| committer | J08nY | 2017-08-02 01:26:57 +0200 |
| commit | 1b7eb8d1b52a9bc4f7e417028d7a48dccc6ae93d (patch) | |
| tree | c654b3a628a3e0bc5b0cae6d0dc7c51c4a22ab52 /src/mailman_pgp/commands/eml_key.py | |
| parent | 3c995fba9f01a75daa395fcc62ce1737a2312501 (diff) | |
| download | mailman-pgp-1b7eb8d1b52a9bc4f7e417028d7a48dccc6ae93d.tar.gz mailman-pgp-1b7eb8d1b52a9bc4f7e417028d7a48dccc6ae93d.tar.zst mailman-pgp-1b7eb8d1b52a9bc4f7e417028d7a48dccc6ae93d.zip | |
Diffstat (limited to 'src/mailman_pgp/commands/eml_key.py')
| -rw-r--r-- | src/mailman_pgp/commands/eml_key.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/mailman_pgp/commands/eml_key.py b/src/mailman_pgp/commands/eml_key.py index be0af44..1f39888 100644 --- a/src/mailman_pgp/commands/eml_key.py +++ b/src/mailman_pgp/commands/eml_key.py @@ -23,6 +23,7 @@ from mailman.interfaces.command import ContinueProcessing, IEmailCommand from mailman.interfaces.pending import IPendings from mailman.interfaces.subscriptions import ISubscriptionManager from mailman.interfaces.usermanager import IUserManager +from pgpy.constants import KeyFlags from public import public from zope.component import getUtility from zope.interface import implementer @@ -74,6 +75,14 @@ def _cmd_set(pgp_list, mlist, msg, msgdata, arguments, results): file=results) return ContinueProcessing.no + usage_flags = key.usage_flags() + for subkey in key.subkeys.values(): + usage_flags |= subkey.usage_flags() + if KeyFlags.EncryptCommunications not in usage_flags: + print('Need a key which can be used to encrypt communications.', + file=results) + return ContinueProcessing.no + email = get_email(msg) if not email: print('No email to subscribe with.', file=results) @@ -219,6 +228,14 @@ def _cmd_change(pgp_list, mlist, msg, msgdata, arguments, results): file=results) return ContinueProcessing.no + usage_flags = key.usage_flags() + for subkey in key.subkeys.values(): + usage_flags |= subkey.usage_flags() + if KeyFlags.EncryptCommunications not in usage_flags: + print('Need a key which can be used to encrypt communications.', + file=results) + return ContinueProcessing.no + workflow = KeyChangeWorkflow(mlist, pgp_address, key) list(workflow) print('Key change request received.', file=results) |
