summaryrefslogtreecommitdiff
path: root/src/mailman_pgp/pgp/inline.py
diff options
context:
space:
mode:
authorJ08nY2017-08-02 00:15:21 +0200
committerJ08nY2017-08-02 01:35:10 +0200
commitfa2b97fb2e6e75af8bfc0bc3620b1a37179bdedc (patch)
tree5dee4554ab4b99fb2dd9b93f8e43a4978ad0d469 /src/mailman_pgp/pgp/inline.py
parentdff7befbc5860f2f78f63ab694ef88d21a53771f (diff)
downloadmailman-pgp-fa2b97fb2e6e75af8bfc0bc3620b1a37179bdedc.tar.gz
mailman-pgp-fa2b97fb2e6e75af8bfc0bc3620b1a37179bdedc.tar.zst
mailman-pgp-fa2b97fb2e6e75af8bfc0bc3620b1a37179bdedc.zip
Diffstat (limited to 'src/mailman_pgp/pgp/inline.py')
-rw-r--r--src/mailman_pgp/pgp/inline.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/mailman_pgp/pgp/inline.py b/src/mailman_pgp/pgp/inline.py
index cf92ffc..49f0a6e 100644
--- a/src/mailman_pgp/pgp/inline.py
+++ b/src/mailman_pgp/pgp/inline.py
@@ -18,11 +18,13 @@
"""Strict inline PGP message wrapper."""
import copy
from email.iterators import walk
+from email.mime.text import MIMEText
from pgpy import PGPMessage
from pgpy.constants import SymmetricKeyAlgorithm
from public import public
+from mailman_pgp.utils.email import make_multipart
from mailman_pgp.utils.pgp import key_from_blob, revoc_from_blob
@@ -211,6 +213,21 @@ class InlineWrapper:
continue
yield revoc
+ def attach_revocs(self, *key_revocations):
+ """
+ Attach a key revocation signature to the message.
+
+ :param key_revocations: A key revocation signature to attach.
+ :type key_revocations: pgpy.PGPSignature
+ :return: The message with the signature attached.
+ :rtype: mailman.email.message.Message
+ """
+ out = make_multipart(self.msg)
+ for key_revocation in key_revocations:
+ revoc_part = MIMEText(str(key_revocation))
+ out.attach(revoc_part)
+ return out
+
def verify(self, key):
"""
Verify the signatures of this message with key.