1.1 --- a/tests/test_encrypt.py Fri Oct 19 00:33:37 2012 +0200
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,33 +0,0 @@
1.4 -#!/usr/bin/env python
1.5 -
1.6 -from email.mime.multipart import MIMEMultipart
1.7 -from email.mime.application import MIMEApplication
1.8 -from email.mime.base import MIMEBase
1.9 -from email.encoders import encode_noop
1.10 -import sys
1.11 -
1.12 -if __name__ == "__main__":
1.13 - text = sys.stdin.read()
1.14 - protocol = "application/pgp-encrypted"
1.15 - subtype = "encrypted"
1.16 -
1.17 - # Make the container for the message.
1.18 -
1.19 - message = MIMEMultipart(subtype, protocol=protocol)
1.20 -
1.21 - # For encrypted content, add the declaration and content.
1.22 -
1.23 - declaration = MIMEBase("application", "pgp-encrypted")
1.24 - declaration.set_payload("Version: 1")
1.25 - message.attach(declaration)
1.26 -
1.27 - content = MIMEApplication(text, "octet-stream", encode_noop)
1.28 - message.attach(content)
1.29 -
1.30 - # Show the resulting message text.
1.31 -
1.32 - text = message.as_string()
1.33 -
1.34 - print text
1.35 -
1.36 -# vim: tabstop=4 expandtab shiftwidth=4
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/tests/test_encrypt_wrap.py Sat Oct 20 18:21:20 2012 +0200
2.3 @@ -0,0 +1,33 @@
2.4 +#!/usr/bin/env python
2.5 +
2.6 +from email.mime.multipart import MIMEMultipart
2.7 +from email.mime.application import MIMEApplication
2.8 +from email.mime.base import MIMEBase
2.9 +from email.encoders import encode_noop
2.10 +import sys
2.11 +
2.12 +if __name__ == "__main__":
2.13 + text = sys.stdin.read()
2.14 + protocol = "application/pgp-encrypted"
2.15 + subtype = "encrypted"
2.16 +
2.17 + # Make the container for the message.
2.18 +
2.19 + message = MIMEMultipart(subtype, protocol=protocol)
2.20 +
2.21 + # For encrypted content, add the declaration and content.
2.22 +
2.23 + declaration = MIMEBase("application", "pgp-encrypted")
2.24 + declaration.set_payload("Version: 1")
2.25 + message.attach(declaration)
2.26 +
2.27 + content = MIMEApplication(text, "octet-stream", encode_noop)
2.28 + message.attach(content)
2.29 +
2.30 + # Show the resulting message text.
2.31 +
2.32 + text = message.as_string()
2.33 +
2.34 + print text
2.35 +
2.36 +# vim: tabstop=4 expandtab shiftwidth=4
3.1 --- a/tests/test_sign.py Fri Oct 19 00:33:37 2012 +0200
3.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
3.3 @@ -1,33 +0,0 @@
3.4 -#!/usr/bin/env python
3.5 -
3.6 -from email.mime.multipart import MIMEMultipart
3.7 -from email.mime.application import MIMEApplication
3.8 -from email.mime.base import MIMEBase
3.9 -from email import message_from_string
3.10 -import sys
3.11 -
3.12 -if __name__ == "__main__":
3.13 - message = sys.argv[1]
3.14 - text = open(message).read()
3.15 - signature = sys.stdin.read()
3.16 - protocol = "application/pgp-signature"
3.17 - subtype = "signed"
3.18 -
3.19 - # Make the container for the message.
3.20 -
3.21 - message = MIMEMultipart(subtype, protocol=protocol)
3.22 -
3.23 - submessage = message_from_string(text)
3.24 - message.attach(submessage)
3.25 -
3.26 - signature_part = MIMEBase("application", "pgp-signature")
3.27 - signature_part.set_payload(signature)
3.28 - message.attach(signature_part)
3.29 -
3.30 - # Show the resulting message text.
3.31 -
3.32 - text = message.as_string()
3.33 -
3.34 - print text
3.35 -
3.36 -# vim: tabstop=4 expandtab shiftwidth=4
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4.2 +++ b/tests/test_sign_wrap.py Sat Oct 20 18:21:20 2012 +0200
4.3 @@ -0,0 +1,33 @@
4.4 +#!/usr/bin/env python
4.5 +
4.6 +from email.mime.multipart import MIMEMultipart
4.7 +from email.mime.application import MIMEApplication
4.8 +from email.mime.base import MIMEBase
4.9 +from email import message_from_string
4.10 +import sys
4.11 +
4.12 +if __name__ == "__main__":
4.13 + message = sys.argv[1]
4.14 + text = open(message).read()
4.15 + signature = sys.stdin.read()
4.16 + protocol = "application/pgp-signature"
4.17 + subtype = "signed"
4.18 +
4.19 + # Make the container for the message.
4.20 +
4.21 + message = MIMEMultipart(subtype, protocol=protocol)
4.22 +
4.23 + submessage = message_from_string(text)
4.24 + message.attach(submessage)
4.25 +
4.26 + signature_part = MIMEBase("application", "pgp-signature")
4.27 + signature_part.set_payload(signature)
4.28 + message.attach(signature_part)
4.29 +
4.30 + # Show the resulting message text.
4.31 +
4.32 + text = message.as_string()
4.33 +
4.34 + print text
4.35 +
4.36 +# vim: tabstop=4 expandtab shiftwidth=4