[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[minion-cvs] Changed base-64 encoding to wrap at 64-characters inste...



Update of /home/minion/cvsroot/src/minion/lib/mixminion/server
In directory moria.mit.edu:/tmp/cvs-serv4265/lib/mixminion/server

Modified Files:
	PacketHandler.py 
Log Message:
Changed base-64 encoding to wrap at 64-characters instead of 76.

Why was this necessary?  Because Outlook breaks up long lines, you see.

But it isn't as simple as that.  If Outlook simply turned "ABC\n" into 
"AB\nC\n", we'd be fine.  Instead, Outlook searches for a plus sign, and
turns "A+BC\n" into "A+B\nA+C\n", thus **corrupting** the data.

I hope those responsible for this feature -- which they doubtlessly
thought was very clever indeed -- are deeply, deeply ashamed of
themselves.  

Clippy helpfully says: "You seem to be corrupting user data.  Do you
want me to teach you about transport layers?"



Index: PacketHandler.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/server/PacketHandler.py,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- PacketHandler.py	13 Feb 2003 06:30:23 -0000	1.10
+++ PacketHandler.py	16 Feb 2003 04:50:56 -0000	1.11
@@ -3,8 +3,9 @@
 
 """mixminion.PacketHandler: Code to process mixminion packets on a server"""
 
-import base64
+import binascii
 
+from mixminion.Common import encodeBase64, formatBase64
 import mixminion.Crypto as Crypto
 import mixminion.Packet as Packet
 import mixminion.Common as Common
@@ -323,11 +324,11 @@
         if self.type == 'plain' and isPrintingAscii(self.contents, allowISO=1):
             return self.contents
         else:
-            return base64.encodestring(self.contents)
+            return encodeBase64(self.contents)
 
     def getAsciiTag(self):
         """Return a base64-representation of this message's decoding handle."""
-        return base64.encodestring(self.tag).strip()
+        return formatBase64(self.tag)
 
     def getTextEncodedMessage(self):
         """Return a Packet.TextEncodedMessage object for this packet."""