1 # Copyright (c) 2012 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.
8 _SCRIPT_PATH
= os
.path
.dirname(sys
.argv
[0])
10 _SCRIPT_PATH
= os
.getcwd()
14 '..\\..\\build\\Debug',
15 '..\\..\\build\\Release',
18 '../../xcodebuild/Debug',
19 '../../xcodebuild/Release',
24 def locate_executable(exe_name
):
25 for path
in _EXE_PATHS_TO_TRY
:
26 exe_path
= os
.path
.join(_SCRIPT_PATH
, path
, exe_name
)
27 if os
.path
.exists(exe_path
):
29 exe_path
= exe_path
+ ".exe"
30 if os
.path
.exists(exe_path
):
33 raise Exception("Could not locate executable '%s'" % exe_name
)
36 def generateRSAKeyPair():
37 """Returns (priv, pub) keypair where priv is a new private key and
38 pub is the corresponding public key. Both keys are BASE64 encoded."""
39 keygen_path
= locate_executable("remoting_host_keygen")
40 pipe
= os
.popen(keygen_path
)
41 out
= pipe
.readlines()
43 raise Exception("remoting_host_keygen failed.")
44 return (out
[0].strip(), out
[1].strip())