OLD | NEW |
(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()) |
OLD | NEW |