Beispiel #1
0
    def execute(self):
        password = self._getPasswordWithPrompt()
        public_key, private_key = ECGenerator.generateECKeyPair()
        keyFile  = TackKeyFile.create(public_key, private_key, password)
        self.outputFile.write(self.addPemComments(keyFile.serializeAsPem()))

        if self.isVerbose():
            self.writeCryptoVersion()
            sys.stderr.write(str(keyFile))
Beispiel #2
0
 def test_KeyFile(self):
     s = """
 -----BEGIN TACK PRIVATE KEY-----
 AQAAIAAjOxiOdpiMo5qWidXwBTqJHxW5X1zRDBOA4ldqqFuKOSh6JJdrbXk1WsMN
 X/gyaVuHMBhC/g/rjtu/EnmIHoUuT9348iXeeROaLVRPdNqwr+5KEfjtTY7uXA6Q
 mhRUn+XmDePKRucRHYkcQaFPnzglrQ120Dh6aXD4PbtJMWajJtzTMvtEo9pNZhoM
 QTNZNoM=
 -----END TACK PRIVATE KEY-----"""
     publicKey = a2b_hex("87301842fe0feb8edbbf1279881e852e"
                         "4fddf8f225de79139a2d544f74dab0af"
                         "ee4a11f8ed4d8eee5c0e909a14549fe5"
                         "e60de3ca46e7111d891c41a14f9f3825")
     privateKey = a2b_hex("fc815de8b1de13a436e9cd69742cbf2c"
                          "d4c1c9bb33e023401d9291cf2781b754")
     kf = TackKeyFile.createFromPem(s, "asdf")
     assert(kf.getPublicKey().getRawKey() == publicKey)
     assert(kf.getPrivateKey().getRawKey() == privateKey)
     kf2 = TackKeyFile.createFromPem(kf.serializeAsPem(), "asdf")
     assert(kf2.getPublicKey().getRawKey() == publicKey)
     assert(kf2.getPrivateKey().getRawKey() == privateKey)
     public_key, private_key = ECGenerator.generateECKeyPair()
     kf3  = TackKeyFile.create(public_key, private_key, "123")
     kf4 = TackKeyFile.createFromPem(kf3.serializeAsPem(), "123")
     assert(kf3.getPublicKey().getRawKey() == kf4.getPublicKey().getRawKey())
 def execute(self):
     password = self._getPasswordWithPrompt()
     public_key, private_key = ECGenerator.generateECKeyPair()
     keyFile  = TackKeyFile.create(public_key, private_key, password)
     self.outputFile.write(self.addPemComments(keyFile.serializeAsPem()))
     self.printVerbose(str(keyFile))
Beispiel #4
0
 def execute(self):
     password = self._getPasswordWithPrompt()
     public_key, private_key = ECGenerator.generateECKeyPair()
     keyFile = TackKeyFile.create(public_key, private_key, password)
     self.outputFile.write(self.addPemComments(keyFile.serializeAsPem()))
     self.printVerbose(str(keyFile))