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

Unified Diff: remoting/tools/keygen.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
Index: remoting/tools/keygen.py
diff --git a/remoting/tools/keygen.py b/remoting/tools/keygen.py
new file mode 100644
index 0000000000000000000000000000000000000000..81efbbbae7f5cfb714cec6381dbf66b04ae46843
--- /dev/null
+++ b/remoting/tools/keygen.py
@@ -0,0 +1,27 @@
+# Copyright (c) 2010 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import os
+import platform
+import sys
+
+SCRIPT_PATH = os.path.dirname(sys.argv[0])
+if SCRIPT_PATH == "":
+ SCRIPT_PATH = os.getcwd()
+
+if platform.system() == "Windows":
+ KEYGEN_PATH = SCRIPT_PATH + '\..\Debug\chromoting_host_keygen.exe'
+elif platform.system() == "Darwin": # Darwin == MacOSX
+ KEYGEN_PATH = SCRIPT_PATH + '/../../xcodebuild/Debug/chromoting_host_keygen'
+else:
+ KEYGEN_PATH = SCRIPT_PATH + '/../../out/Debug/chromoting_host_keygen'
+
+def generateRSAKeyPair():
+ """Returns (priv, pub) keypair where priv is a new private key and
+ pub corresponding public key. Both keys are BASE64 encoded."""
+ pipe = os.popen(KEYGEN_PATH)
+ out = pipe.readlines()
+ if len(out) != 2:
+ raise Exception("chromoting_host_keygen failed.")
+ return (out[0].strip(), out[1].strip())

Powered by Google App Engine
This is Rietveld 408576698