def setKeyServer(self, keyServerAddr, keyServerPublic): """ Sets the public key for the key server """ self.keyServerAddr = keyServerAddr self.keyServerPublic = crypto.load(keyServerPublic) return self.addKey(self.keyServerPublic, self.keyServerAddr)
def setPrivate(self, privateKey): """ Sets the private key and extracts the public keys """ self.privateKey = crypto.load(privateKey) self.publicKey = crypto.publicKey(self.privateKey) self.publicKeyText = crypto.publicKey(self.privateKey, text=True) return self.privateKey
def getKey(self, host=HOST, port=PORT): """ Requests and loads the servers public key """ # Ask for the servers public key reply, error = self.call("key", host, port, {}, NO_ENCRYPT) # Load the public key self.publicKey = crypto.load(reply) return self.publicKey, error
def requestKey(self, keyRingKey): if self.keyServerAddr != False: # Ask the server for the key publicKey, status = self.call("keyServerGetKey", keyRingKey, self.keyServerAddr) return crypto.load(publicKey) return False