File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2727
2828try :
2929 import sign_m2crypto
30+ rsa_signer = sign_m2crypto .M2CryptoSigner
3031except ImportError :
31- sign_m2crypto = None
32- try :
33- import sign_pythonrsa
34- except ImportError :
35- sign_pythonrsa = None
32+ try :
33+ import sign_pythonrsa
34+ rsa_signer = sign_pythonrsa . PythonRSASigner . FromRSAKeyPath
35+ except ImportError :
36+ rsa_signer = None
3637
3738
3839gflags .ADOPT_module_key_flags (common_cli )
4748
4849def GetRSAKwargs ():
4950 if FLAGS .rsa_key_path :
50- if not sign_m2crypto and not sign_pythonrsa :
51+ if rsa_signer is None :
5152 print >> sys .stderr , 'Please install either M2Crypto or python-rsa'
5253 sys .exit (1 )
53- signer = (
54- sign_m2crypto .M2CryptoSigner if sign_m2crypto
55- else sign_pythonrsa .PythonRSASigner .FromRSAKeyPath )
5654 return {
57- 'rsa_keys' : [signer (os .path .expanduser (path ))
55+ 'rsa_keys' : [rsa_signer (os .path .expanduser (path ))
5856 for path in FLAGS .rsa_key_path ],
5957 'auth_timeout_ms' : int (FLAGS .auth_timeout_s * 1000.0 ),
6058 }
You can’t perform that action at this time.
0 commit comments