def test_sign_without_root_id(certificate_example): root = etree.Element('Data') signed = xml_signing.sign(root, *certificate_example) assert xml_signing.verify(signed, *certificate_example) assert 'MessageRoot' == signed.attrib['Id']
def test_verify_wrong_signature(certificate_example): root = etree.Element('Data', Id='myid') signed = xml_signing.sign(root, *certificate_example) etree.SubElement(signed, 'KeyAfterSigning') assert xml_signing.verify(signed, *certificate_example) is False
def egress(self, envelope, http_headers, operation, binding_options): '''Sign enveloped message''' args = envelope[0][0], self.cert_path, self.key_path signed = xml_signing.sign(*args) data = ''' <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <soapenv:Header/> <soapenv:Body>{}</soapenv:Body> </soapenv:Envelope>'''.format(etree.tostring(signed).decode()) envelope = etree.fromstring(data) return envelope, http_headers
def test_sign_complete_xades_epel(certificate_example): root = etree.Element('Data', Id='myid') signed = xml_signing.sign(root, *certificate_example) assert xml_signing.verify(signed, *certificate_example)
def test_verify_simple_signature(certificate_example): root = etree.Element('Data', Id='myid') signed = xml_signing.sign(root, *certificate_example) assert xml_signing.verify(signed, *certificate_example)