コード例 #1
0
 def getIdentityKey(self):
     keyfile = self.identityfile
     if not os.path.exists(keyfile):
         key = RSAKey.generate(1024)
         key.write_private_key_file(keyfile)
     else:
         try:
             key = DSAKey.from_private_key_file(keyfile)
         except:
             key = RSAKey.from_private_key_file(keyfile)
     return keyfile, "ssh-rsa %s hostout@hostout" % key.get_base64()
コード例 #2
0
ファイル: hostout.py プロジェクト: Cykooz/collective.hostout
 def getIdentityKey(self):
     keyfile = os.path.abspath(os.path.join(self.getLocalBuildoutPath(),'hostout_rsa'))
     keyfile = self.options.get('identity-file', keyfile)
     if not os.path.exists(keyfile):
         key = RSAKey.generate(1024)
         key.write_private_key_file(keyfile)
     else:
         try:
             key = DSAKey.from_private_key_file(keyfile)
         except:
             key = RSAKey.from_private_key_file(keyfile)
     return keyfile, "ssh-rsa %s hostout@hostout" % key.get_base64()