def __verify_message(self, signed_message): content = signed_message.content certificate = content.certificate identity = certificate.identity sender_public_key = certificate.identity.public_key verify(content, sender_public_key, signed_message.signature) verify(identity, self.__ca_public_key, certificate.signature)
def receive(self, signed_message): content = signed_message.content signature = signed_message.signature certificate = content.certificate identity = certificate.identity public_key = certificate.identity.public_key verify(content, public_key, signature) verify(identity, self.__ca_public_key, certificate.signature) self.__node.receive(content.slmp_payload)
def __init__(self, context, timeout=5): key_pair = generate_key_pair() self.__private_key = key_pair.private self.__public_key = key_pair.public self.__ca_public_key = certificate_authority.get_public_key() certificate = certificate_authority.issue_certificate( self.__public_key) verify(certificate.identity, self.__ca_public_key, certificate.signature) self.__certificate = certificate self.__node = SLMPNode(self.__certificate.identity.id, context, timeout)
def __init__(self, _id, context): key_pair = generate_key_pair() self.__private_key = key_pair.private self.__public_key = key_pair.public certificate = certificate_authority.issue_certificate( self.__public_key) self.__certificate = certificate self.__ca_public_key = certificate_authority.get_public_key() verify(certificate.identity, self.__ca_public_key, certificate.signature) self.__id = _id self.__context = context self.__installed_view = None
def receive(self, signed_message): view_broadcast = signed_message.content verify(view_broadcast, self.__ca_public_key, signed_message.signature) self.__installed_view = view_broadcast
def receive(self, signed_message): content = signed_message.content signature = signed_message.signature public_key = content.public_key verify(content, public_key, signature) self.__node.receive(content.slmp_payload)