[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [flashproxy/master] Use UTF-8 encoding for client registrations.
commit 2f1cc8411fb3f99dc7d56239ee7036001b9b9d44
Author: Alex <alex@alex-macair.(none)>
Date: Sun Feb 24 20:46:13 2013 -0500
Use UTF-8 encoding for client registrations.
facilitator-reg-url was receiving registrations in UTF-32
encoding and passing them on verbatim to getaddrinfo(), which
caused it to return bogus results.
---
facilitator/facilitator-reg-url | 2 +-
flashproxy-reg-url | 1 +
2 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/facilitator/facilitator-reg-url b/facilitator/facilitator-reg-url
index 609346e..591c0f1 100755
--- a/facilitator/facilitator-reg-url
+++ b/facilitator/facilitator-reg-url
@@ -69,7 +69,7 @@ def log(msg):
def register(reg):
try:
ciphertext = base64.urlsafe_b64decode(reg)
- client_spec = rsa.private_decrypt(ciphertext, RSA.pkcs1_oaep_padding)
+ client_spec = str(rsa.private_decrypt(ciphertext, RSA.pkcs1_oaep_padding).decode('UTF-8'))
except:
log(u"Error occurred while decoding and decrypting registration:")
traceback.print_exc(file=options.log_file)
diff --git a/flashproxy-reg-url b/flashproxy-reg-url
index 60f7e7b..4e73ed9 100755
--- a/flashproxy-reg-url
+++ b/flashproxy-reg-url
@@ -104,6 +104,7 @@ if len(args) != 1:
addr = parse_addr_spec(args[0], defport=DEFAULT_REMOTE_PORT)
spec = format_addr(addr)
+spec = spec.encode('UTF-8')
rsa = RSA.load_pub_key_bio(BIO.MemoryBuffer(FACILITATOR_PUBKEY_PEM))
ciphertext = rsa.public_encrypt(spec, RSA.pkcs1_oaep_padding)
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits