XML-Security / signxml

Python XML Signature and XAdES library
https://xml-security.github.io/signxml/
Apache License 2.0
137 stars 109 forks source link

signxml.exceptions.InvalidDigest: Digest mismatch for reference 0 () #232

Closed olabanjy closed 1 year ago

olabanjy commented 1 year ago

I am trying to but i keep getting a digest mismatch error. the error is coming specifically from the _verify_reference() method in the verifier module.


<?xml version="1.0" encoding="UTF-8"?>
<Document xmlns="urn:iso:std:iso:20022:tech:xsd:admi.004.001.02">    
<SysEvtNtfctn>        
<EvtInf>            <EvtCd>PING</EvtCd>            <EvtDesc>Connectivity ping event</EvtDesc>            <EvtTm>2023-06-30T15:42:29.884Z</EvtTm>        
</EvtInf>    
</SysEvtNtfctn>
<ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#" Id="_63783abd-b08b-4d59-9941-3ab8b357db7c"><ds:SignedInfo><ds:CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/><ds:SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"/><ds:Reference URI=""><ds:Transforms><ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"/><ds:Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/></ds:Transforms><ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/><ds:DigestValue>hE1D+zfqF4RGkvRyxHLj1mv+noUcf1holSGGBptN11w=</ds:DigestValue></ds:Reference><ds:Reference URI="#_3fa30888-0284-4838-8280-59d942a9c567"><ds:Transforms><ds:Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/></ds:Transforms><ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/><ds:DigestValue>kvD7dmW5LY1ySaBvzge1L+aVCWRaltrOncwvghf0/YQ=</ds:DigestValue></ds:Reference></ds:SignedInfo><ds:SignatureValue>yXxDVTrFvW9DChI85E1a9cDV5svIgsnsvTyW1u1ZlSQnHIkQYbZ9N5+9bTpSU6D8TRRoCIeNpN/2OwjFdV8R7J83Wq0VYx7h/j5pASksmrnK+lWUAAyqd3LVWUyTBnuz/Rm2rej1MMNcPnIt6AlXme/nM8Ra7bsnEgRscengI9Y2thtPP/aunyftFQBFcEZRa+MkGtEetUiiSEOwuYY3bV2ViDTzme3dwgg3mW5dt2TtmmdkIy3KJsT8nzMWIxdhv/gZY4eNEkFp6koEhdt23S5k3iQgC89H4z5ZMyIJLDMsagtyEUsqCf7TS5y....</ds:SignatureValue><ds:KeyInfo Id="_3fa30888-0284-4838-8280-59d942a9c567"><ds:X509Data><ds:X509Certificate>MIIFdzCCA1+gAwIBAgIUB4BFCGWUoEZWj8V3yBG7mUjQFxIwDQYJKoZIhvcNAQELBQAwfzELMAkGA1UEBhMCS0UxEDAOBgNVBAgMB05haXJvYmkxDTALBgNVBAoMBElQU0wxEzARBgNVBAsMClRlY2hub2xvZ3kxGjAYBgNVBAMMEUlQU0wgSW50ZXJtZWRpYXRlMR4wHAYJKoZIhvcNAQkBFg9pbmZvQGlwc2wuY28ua2UwHhcNMjIwODI5MTIzODUzWhcNMjMxMDAxMTIzOTIzWjBZMQswCQYDVQQGEwJLRTEQMA4GA1UEBxMHTmFpcm9iaTENMAsGA1UEChMESVBTTDERMA8GA1UECxMIUGF5bWVu....</ds:X509Certificate></ds:X509Data></ds:KeyInfo>
</ds:Signature>
</Document>
``` `