1.1 --- a/MoinMessage.py Tue Jan 07 20:08:13 2014 +0100
1.2 +++ b/MoinMessage.py Tue Jan 07 23:46:19 2014 +0100
1.3 @@ -2,7 +2,7 @@
1.4 """
1.5 MoinMoin - MoinMessage library
1.6
1.7 - @copyright: 2012, 2013 by Paul Boddie <paul@boddie.org.uk>
1.8 + @copyright: 2012, 2013, 2014 by Paul Boddie <paul@boddie.org.uk>
1.9 @license: GNU GPL (v2 or later), see COPYING.txt for details.
1.10 """
1.11
1.12 @@ -279,12 +279,7 @@
1.13 # Verify the message.
1.14
1.15 fingerprint, identity = self.verifyMessageText(signature.get_payload(decode=True), content.as_string())
1.16 -
1.17 - # Extract the actual content inside the signed message.
1.18 - # This reverses the wrapping up of signed content in a
1.19 - # representation-insensitive container.
1.20 -
1.21 - return fingerprint, identity, Parser().parsestr(content.get_payload(decode=True))
1.22 + return fingerprint, identity, getOriginalContent(content)
1.23
1.24 def signMessage(self, message, keyid):
1.25
1.26 @@ -294,8 +289,7 @@
1.27
1.28 # Make a representation-insensitive container for the message.
1.29
1.30 - text = message.as_string()
1.31 - content = MIMEApplication(text)
1.32 + content = MIMEApplication(message.as_string())
1.33
1.34 # Sign the container's representation.
1.35
1.36 @@ -491,6 +485,15 @@
1.37 except ValueError:
1.38 raise MoinMessageMissingPart
1.39
1.40 +def getOriginalContent(content):
1.41 +
1.42 + """
1.43 + Extract the actual content inside the signed message. This reverses the
1.44 + wrapping up of signed content in a representation-insensitive container.
1.45 + """
1.46 +
1.47 + return Parser().parsestr(content.get_payload(decode=True))
1.48 +
1.49 # Communications functions.
1.50
1.51 def timestamp(message):
2.1 --- a/MoinMessageSupport.py Tue Jan 07 20:08:13 2014 +0100
2.2 +++ b/MoinMessageSupport.py Tue Jan 07 23:46:19 2014 +0100
2.3 @@ -2,7 +2,7 @@
2.4 """
2.5 MoinMoin - MoinMessageSupport library
2.6
2.7 - @copyright: 2012, 2013 by Paul Boddie <paul@boddie.org.uk>
2.8 + @copyright: 2012, 2013, 2014 by Paul Boddie <paul@boddie.org.uk>
2.9 @license: GNU GPL (v2 or later), see COPYING.txt for details.
2.10 """
2.11
2.12 @@ -16,7 +16,8 @@
2.13 from TokenSupport import getIdentifiers
2.14 from MoinMessage import GPG, Message, MoinMessageError, \
2.15 MoinMessageMissingPart, MoinMessageBadContent, \
2.16 - is_signed, is_encrypted, getContentAndSignature
2.17 + is_signed, is_encrypted, getContentAndSignature, \
2.18 + getOriginalContent
2.19 from email.parser import Parser
2.20 import time
2.21
2.22 @@ -166,7 +167,7 @@
2.23 # Handle the embedded message.
2.24
2.25 content, signature = getContentAndSignature(message)
2.26 - self.handle_message_content(content)
2.27 + self.handle_message_content(getOriginalContent(content))
2.28
2.29 # Reject any unverified message.
2.30