aboutsummaryrefslogtreecommitdiff
path: root/src/mailman_pgp/commands/eml_key.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/mailman_pgp/commands/eml_key.py')
-rw-r--r--src/mailman_pgp/commands/eml_key.py12
1 files changed, 3 insertions, 9 deletions
diff --git a/src/mailman_pgp/commands/eml_key.py b/src/mailman_pgp/commands/eml_key.py
index 0d5fa1e..e182451 100644
--- a/src/mailman_pgp/commands/eml_key.py
+++ b/src/mailman_pgp/commands/eml_key.py
@@ -23,7 +23,6 @@ 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
@@ -35,6 +34,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.workflows.key_change import (CHANGE_CONFIRM_REQUEST,
KeyChangeModWorkflow,
KeyChangeWorkflow)
@@ -77,10 +77,7 @@ 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:
+ if not key_usable(key):
print('Need a key which can be used to encrypt communications.',
file=results)
return ContinueProcessing.no
@@ -231,10 +228,7 @@ 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:
+ if not key_usable(key):
print('Need a key which can be used to encrypt communications.',
file=results)
return ContinueProcessing.no