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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 # Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 import os
6 import platform
7 import sys
8
9 SCRIPT_PATH = os.path.dirname(sys.argv[0])
10 if SCRIPT_PATH == "":
11 SCRIPT_PATH = os.getcwd()
12
13 if platform.system() == "Windows":
14 KEYGEN_PATH = SCRIPT_PATH + '\..\Debug\chromoting_host_keygen.exe'
15 elif platform.system() == "Darwin": # Darwin == MacOSX
16 KEYGEN_PATH = SCRIPT_PATH + '/../../xcodebuild/Debug/chromoting_host_keygen'
17 else:
18 KEYGEN_PATH = SCRIPT_PATH + '/../../out/Debug/chromoting_host_keygen'
19
20 def generateRSAKeyPair():
21 """Returns (priv, pub) keypair where priv is a new private key and
22 pub corresponding public key. Both keys are BASE64 encoded."""
23 pipe = os.popen(KEYGEN_PATH)
24 out = pipe.readlines()
25 if len(out) != 2:
26 raise Exception("chromoting_host_keygen failed.")
27 return (out[0].strip(), out[1].strip())
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698