def receivedSessionKey(self, sessionKey, authConnection): if self.deffered is not None: d, self.deffered = self.deffered, None keyFactory = SessionKeyFactory() key = keyFactory.createAESKeyFromHex(sessionKey) d.callback((key, authConnection))
def generateSessionKey(self, cert): if cert in self.sessionKeys: raise AuthorityError("Duplicate Certificate, session key for certificate already exists") # Generate and store session key keyFactory = SessionKeyFactory() key = keyFactory.createAESKey() self.sessionKeys[cert.as_pem()] = key return key
def _sendRequest(self): message = SecureMessage() sessionKeyFactory = SessionKeyFactory() sessionKey = sessionKeyFactory.createAESKey() self.factory.collectorNode.authKey = sessionKey logger.debug("Created session key for Authority connection:") logger.debug(sessionKey.hex(), False) authKey = app.keyManager.findKey("authority") encryptedKey = authKey.publicEncrypt(sessionKey.hex()) message.action = "request-table" message['encrypted-session-key'] = encryptedKey message.sign() self.sendMessage(message)