summaryrefslogtreecommitdiff
path: root/memoryhole/protection.py
diff options
context:
space:
mode:
Diffstat (limited to 'memoryhole/protection.py')
-rw-r--r--memoryhole/protection.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/memoryhole/protection.py b/memoryhole/protection.py
index 900b29a..b179614 100644
--- a/memoryhole/protection.py
+++ b/memoryhole/protection.py
@@ -1,10 +1,28 @@
from email.mime.application import MIMEApplication
+from email.utils import getaddresses, parseaddr
from memoryhole.gpg import Gnupg
from memoryhole.rfc3156 import PGPEncrypted, MultipartEncrypted
def protect(msg, openpgp=Gnupg(), encrypt=True, obscure=True):
+ """
+ Protect an email with memory hole. It will protect the PROTECTED_HEADERS
+ and if obscure=True will obscure the OBSCURED_HEADERS
+
+ :param msg: the email to be protected
+ :type msg: Message
+ :param openpgp: the implementation of openpgp to use for encryption and/or
+ signature
+ :type openpgp: OpenPGP
+ :param encrypt: should the message be encrypted
+ :type encrypt: bool
+ :param obscure: should the headers be obscured
+ :type obsucre: bool
+
+ :return: an encrypted and/or signed email
+ :rtype: Message
+ """
if encrypt:
return _encrypt_mime(msg, openpgp)