[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [flashproxy/master] Encode to UTF-8 before encryption.



commit d97e41a5baf4874f19bcd7a9f69a35cfc14ae102
Author: David Fifield <david@xxxxxxxxxxxxxxx>
Date:   Wed Sep 19 13:58:19 2012 -0700

    Encode to UTF-8 before encryption.
    
    Otherwise the M2Crypto encryption seems to expand each character to 4
    bytes; i.e., u"client" becomes
    "c\x00\x00\x00l\x00\x00\x00i\x00\x00\x00e\x00\x00\x00n\x00\x00\x00t\x00\x00\x00"
    after decryption.
---
 flashproxy-reg-email |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/flashproxy-reg-email b/flashproxy-reg-email
index babcc85..debe16d 100755
--- a/flashproxy-reg-email
+++ b/flashproxy-reg-email
@@ -238,7 +238,7 @@ try:
             spec = "[" + spec + "]"
         options.remote_addr = parse_addr_spec(spec, *options.remote_addr)
 
-    body_plain = "client=%s" % format_addr(options.remote_addr)
+    body_plain = (u"client=%s" % format_addr(options.remote_addr)).encode("utf-8")
     rsa = RSA.load_pub_key_bio(BIO.MemoryBuffer(FACILITATOR_PUBKEY_PEM))
     body_crypt = rsa.public_encrypt(body_plain, RSA.pkcs1_oaep_padding)
     body = body_crypt.encode("base64")



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits