Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1013)

Unified Diff: remoting/tools/register_host.py

Issue 2958001: Added RSA key generator for register_host.py (Closed)
Patch Set: - Created 10 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« remoting/host/keygen_main.cc ('K') | « remoting/tools/keygen.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/tools/register_host.py
diff --git a/remoting/tools/register_host.py b/remoting/tools/register_host.py
index 5518818335b1e347734061b0561f98de7316da30..166a54a0176afee2582209d337187852987acea4 100755
--- a/remoting/tools/register_host.py
+++ b/remoting/tools/register_host.py
@@ -16,6 +16,7 @@ import socket
import sys
import gaia_auth
+import keygen
server = 'www-googleapis-test.sandbox.google.com'
url = 'http://' + server + '/chromoting/v1/@me/hosts'
@@ -34,19 +35,17 @@ host_id = str(uuid.uuid1())
print "HostId:", host_id
host_name = socket.gethostname()
print "HostName:", host_name
-# TODO(sergeyu): Implement keypair generation.
-public_key = '123123'
-jingle_id = ''
-#f = urllib.urlopen(url, params);
-#print params
+print "Generating RSA key pair...",
+(private_key, public_key) = keygen.generateRSAKeyPair()
+print "Done"
+
params = ('{"data":{' + \
'"host_id": "%(host_id)s",' + \
'"host_name": "%(host_name)s",' + \
- '"public_key": "%(public_key)s",' + \
- '"jingle_id": "%(jingle_id)s"}}') % \
+ '"public_key": "%(public_key)s"}}') % \
{'host_id': host_id, 'host_name': host_name,
- 'public_key': public_key, 'jingle_id': jingle_id}
+ 'public_key': public_key}
headers = {"Authorization": "GoogleLogin auth=" + xapi_token,
"Content-Type": "application/json" }
request = urllib2.Request(url, params, headers)
@@ -78,7 +77,7 @@ settings_file.write(' "xmpp_login" : "' + email + '",\n')
settings_file.write(' "xmpp_auth_token" : "' + auth_token + '",\n')
settings_file.write(' "host_id" : "' + host_id + '",\n')
settings_file.write(' "host_name" : "' + host_name + '",\n')
-settings_file.write(' "public_key" : "' + public_key + '"\n')
+settings_file.write(' "private_key" : "' + private_key + '",\n')
settings_file.write('}\n')
settings_file.close()
« remoting/host/keygen_main.cc ('K') | « remoting/tools/keygen.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698