[tor-commits] [flashproxy/master] get_facilitator_pubkey read from the global options.

dcf at torproject.org dcf at torproject.org
Tue Apr 30 07:07:50 UTC 2013


commit 4041f936d599f2aeb3c099668b8f46ff30937a91
Author: David Fifield <david at bamsoftware.com>
Date:   Mon Apr 29 23:44:54 2013 -0700

    get_facilitator_pubkey read from the global options.
---
 flashproxy-reg-email |    8 ++++----
 flashproxy-reg-url   |    8 ++++----
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/flashproxy-reg-email b/flashproxy-reg-email
index 45609c9..5164c7e 100755
--- a/flashproxy-reg-email
+++ b/flashproxy-reg-email
@@ -78,9 +78,9 @@ gwIDAQAB
 -----END PUBLIC KEY-----
 """
 
-def get_facilitator_pubkey(filename):
-    if filename is not None:
-        return RSA.load_pub_key(filename)
+def get_facilitator_pubkey():
+    if options.facilitator_pubkey_filename is not None:
+        return RSA.load_pub_key(options.facilitator_pubkey_filename)
     else:
         return RSA.load_pub_key_bio(
             BIO.MemoryBuffer(DEFAULT_FACILITATOR_PUBKEY_PEM))
@@ -281,7 +281,7 @@ try:
         options.remote_addr = parse_addr_spec(spec, *options.remote_addr)
 
     body_plain = (u"client=%s" % format_addr(options.remote_addr)).encode("utf-8")
-    rsa = get_facilitator_pubkey(options.facilitator_publickey_filename)
+    rsa = get_facilitator_pubkey()
     body_crypt = rsa.public_encrypt(body_plain, RSA.pkcs1_oaep_padding)
     body = body_crypt.encode("base64")
 
diff --git a/flashproxy-reg-url b/flashproxy-reg-url
index b9cdcc9..b094b9b 100755
--- a/flashproxy-reg-url
+++ b/flashproxy-reg-url
@@ -23,9 +23,9 @@ gwIDAQAB
 -----END PUBLIC KEY-----
 """
 
-def get_facilitator_pubkey(filename):
-    if filename is not None:
-        return RSA.load_pub_key(filename)
+def get_facilitator_pubkey():
+    if options.facilitator_pubkey_filename is not None:
+        return RSA.load_pub_key(options.facilitator_pubkey_filename)
     else:
         return RSA.load_pub_key_bio(
             BIO.MemoryBuffer(DEFAULT_FACILITATOR_PUBKEY_PEM))
@@ -124,7 +124,7 @@ if remote_addr[0] is None:
     sys.exit(1)
 
 reg_plain = (u"client=%s" % format_addr(remote_addr)).encode("utf-8")
-rsa = get_facilitator_pubkey(options.facilitator_publickey_filename)
+rsa = get_facilitator_pubkey()
 reg_crypt = rsa.public_encrypt(reg_plain, RSA.pkcs1_oaep_padding)
 reg = base64.urlsafe_b64encode(reg_crypt)
 





More information about the tor-commits mailing list