async def on_create_party_registration(payload, future): if payload['fingerprint'] != ven_fingerprint: raise errors.FingerprintMismatch( "The fingerprint of your TLS connection does not match the expected fingerprint. Your VEN is not allowed to register." ) else: future.set_result(True) return 'ven1234', 'reg5678'
def validate_xml_signature(xml_tree, cert_fingerprint=None): """ Validate the XMLDSIG signature and the ReplayProtect element. """ cert = utils.extract_pem_cert(xml_tree) if cert_fingerprint: fingerprint = utils.certificate_fingerprint(cert) if fingerprint != cert_fingerprint: raise errors.FingerprintMismatch("The certificate fingerprint was incorrect. " f"Expected: {cert_fingerprint};" f"Received: {fingerprint}") VERIFIER.verify(xml_tree, x509_cert=utils.ensure_bytes(cert), expect_references=2) _verify_replay_protect(xml_tree)