diff options
Diffstat (limited to 'src/mailman_pgp/pgp/mime.py')
| -rw-r--r-- | src/mailman_pgp/pgp/mime.py | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/mailman_pgp/pgp/mime.py b/src/mailman_pgp/pgp/mime.py index a7e31b8..611c1f2 100644 --- a/src/mailman_pgp/pgp/mime.py +++ b/src/mailman_pgp/pgp/mime.py @@ -116,6 +116,12 @@ class MIMEWrapper: return self.is_encrypted() def is_keys(self): + """ + Whether the message has only keys as per RFC3156 section 7. + + :return: If the message is keys. + :rtype: bool + """ for part in walk(self.msg): if (not part.is_multipart() # noqa and part.get_content_type() != MIMEWrapper._keys_type): @@ -149,10 +155,12 @@ class MIMEWrapper: def attach_key(self, key): """ + Attach a key to this message, as per RFC3156 section 7. - :param key: + :param key: A key to attach. :type key: pgpy.PGPKey - :return: + :return: The message with the key attached. + :rtype: mailman.email.message.Message """ filename = '0x' + key.fingerprint.keyid + '.asc' key_part = MIMEApplication(_data=str(key), @@ -220,7 +228,7 @@ class MIMEWrapper: :param key: The key to sign with. :type key: pgpy.PGPKey :param hash: - :type hash: HashAlgorithm + :type hash: pgpy.constants.HashAlgorithm :return: The signed message. :rtype: mailman.email.message.Message """ @@ -293,7 +301,7 @@ class MIMEWrapper: :param keys: The key/s to encrypt with. :type keys: pgpy.PGPKey :param cipher: The symmetric cipher to use. - :type cipher: SymmetricKeyAlgorithm + :type cipher: pgpy.constants.SymmetricKeyAlgorithm :return: The encrypted message. :rtype: mailman.email.message.Message """ |
