PeculiarVentures / xadesjs

A pure Typescript/Javascript implementation of XAdES based on XMLDSIGjs. (Keywords: WebCrypto, XMLDSIG, XADES, eIDAS, Trust List, X.509, CRL, OCSP)
https://xadesjs.com
MIT License
141 stars 49 forks source link

inconsistent behaviour between web crypto and openssl #66

Open Alttaf opened 6 years ago

Alttaf commented 6 years ago

When using a browser I can validate the following digsig

<?xml version="1.0" encoding="UTF-8"?><ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#" Id="1515159712853"><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#ecdsa-sha256"/><ds:Reference Id="HVE-A04C" Type="http://www.w3.org/2000/09/xmldsig#Object" URI="#o_HVE-A04C"><ds:Transforms><ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#base64"/></ds:Transforms><ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/><ds:DigestValue>HpX/S7hxefbA9QVC1nkiVm2LDesYtnXd7kSYExa7sWU=</ds:DigestValue></ds:Reference><ds:Reference Type="http://uri.etsi.org/01903#SignedProperties" URI="#xades-id-1515159712853"><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>34ppnIRMCSgZ1OOJiCFVyC/4RtMmdSku9GVjZXAt8co=</ds:DigestValue></ds:Reference></ds:SignedInfo><ds:SignatureValue Id="value-1515159712853">HfFMx+ImtdufDGdECbIfoJJMuhTz351PvEjdUQz/NtSvpDBCbQeh+3tnQnrjDTKtrv5qxLgMhP4E8X7Vd9GlYTy8/V/nI1TandaAfHOGFuNQyB1rDHnvkMKc5Ftc6LBP</ds:SignatureValue><ds:KeyInfo><ds:X509Data><ds:X509Certificate>MIIF4zCCA8ugAwIBAgIQG2CRCTTS1bp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sGAQUFBzABhhtodHRwOi8vYWlhLnNrLmVlL2VzdGVpZDIwMTUwMQYIKwYBBQUHMAKGJWh0dHA6Ly9jLnNrLmVlL0VTVEVJRC1TS18yMDE1LmRlci5jcnQwPAYDVR0fBDUwMzAxoC+gLYYraHR0cDovL3d3dy5zay5lZS9jcmxzL2VzdGVpZC9lc3RlaWQyMDE1LmNybDANBgkqhkiG9w0BAQsFAAOCAgEAhEU+Tkf+TCcLNCYX1rYt4o9iLBnP5CibrHEACQGEeaW5nB6lAqkHENz7NCPR/f36uSMt34uXtuXBQ+5vyHF+JdB+TO+w6x3sRWxWGz8GZz75fDi6HzYDCd1L66Jbe5zBsaSO3+GKWmU8b2ANDXuAxX6E+oXAQ8FaqVcH+ZEorl+3EpqwJYOfRbC29eU2RmV/Bkldi7nUK5eRa3kqTFOnKUUVtZEMIyDqVlCYOKIcZLQuaPjbYJERQg7UKqE11I3hPpKKJMUfyC4EDvf1jVKaBM+JdyUEBj4HZkeWix/c8Vg5WP8/vQANAvRl+ncS912zLK2flBsKQiQlv3dqSsnrWo+GIif/xuyDyGtju8Rjh0s+vA/lcoCw3hr4xTrVmAkKtSc9HPQU3evUl6AX7zCTbs0zhxpA9dJDPu4+ch5mZo5JGPhfwp0UZdczdJ2eN6vFeNDHBI6TnigHX8K8R/RXkGlkShUocLIeLoej60nahyZri0wbNbXdwm8HGGUEC4vw9n/GpnHiKSaz4VKg3xWKKghbJiy7giXRig1lQQHb1yCz0pjsMgd9sktc3MoO4/OHEahrtohj08PYdDX2F9Xl8+6dPW2RNBuOILCDELoEH7IWKMfTsTJZFDbM4IhsjV/90Oj2F3JI4wbTn6JrM+mnv52KxTwxw1IyIII5DhcHxVo=</ds:X509Certificate></ds:X509Data></ds:KeyInfo><ds:Object><xades:QualifyingProperties xmlns:xades="http://uri.etsi.org/01903/v1.3.2#" Target="#1515159712853"><xades:SignedProperties Id="xades-id-1515159712853"><xades:SignedSignatureProperties><xades:SigningTime>2018-01-05T13:41:52.856Z</xades:SigningTime><xades:SigningCertificateV2><xades:Cert><xades:CertDigest><ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/><ds:DigestValue>TRTdfSn2Jqz0WG0LlsLxUkDkQfw=</ds:DigestValue></xades:CertDigest></xades:Cert></xades:SigningCertificateV2></xades:SignedSignatureProperties><xades:SignedDataObjectProperties><xades:DataObjectFormat ObjectReference="#HVE-A04C"><xades:MimeType>text/xml</xades:MimeType></xades:DataObjectFormat><xades:CommitmentTypeIndication><xades:CommitmentTypeId><xades:Identifier>http://uri.etsi.org/01903/v1.2.2#ProofOfApproval</xades:Identifier></xades:CommitmentTypeId><xades:AllSignedDataObjects/></xades:CommitmentTypeIndication></xades:SignedDataObjectProperties></xades:SignedProperties></xades:QualifyingProperties></ds:Object><ds:Object Id="o_HVE-A04C">PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPERvY3VtZW50IHhtbG5zOnhzaT0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEtaW5zdGFuY2UiIHhtbG5zPSJ1cm46aXNvOnN0ZDppc286MjAwMjI6dGVjaDp4c2Q6cGFpbi4wMDEuMDAxLjAzIj4KICA8Q3N0bXJDZHRUcmZJbml0bj4KICAgIDxHcnBIZHI+CiAgICAgIDxNc2dJZD5BQkMvMDkwOTI4L0NDVDAwMTwvTXNnSWQ+CiAgICAgIDxDcmVEdFRtPjIwMTctMDUtMjlUMTM6MDc6NDg8L0NyZUR0VG0+CiAgICAgIDxOYk9mVHhzPjM8L05iT2ZUeHM+CiAgICAgIDxDdHJsU3VtPjExNTAwMDAwPC9DdHJsU3VtPgogICAgICA8SW5pdGdQdHk+CiAgICAgICAgPE5tPkFCQyBDb3Jwb3JhdGlvbjwvTm0+CiAgICAgICAgPFBzdGxBZHI+CiAgICAgICAgICA8U3RydE5tPlRpbWVzIFNxdWFyZTwvU3RydE5tPgogICAgICAgICAgPEJsZGdOYj43PC9CbGRnTmI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W5zdHJJZD5BQkMvMDkwOTI4L0NDVDAwMS8wMTwvSW5zdHJJZD4KICAgICAgICAgIDxFbmRUb0VuZElkPkFCQy80NTYyLzIwMDktMDktMDg8L0VuZFRvRW5kSWQ+CiAgICAgICAgPC9QbXRJZD4KICAgICAgICA8QW10PgogICAgICAgICAgPEluc3RkQW10IENjeT0iSlBZIj4xMDAwMDAwMDwvSW5zdGRBbXQ+CiAgICAgICAgPC9BbXQ+CiAgICAgICAgPENocmdCcj5TSEFSPC9DaHJnQnI+CiAgICAgICAgPENkdHJBZ3Q+CiAgICAgICAgICA8RmluSW5zdG5JZD4KICAgICAgICAgICAgPEJJQz5BQUFBR0IyTDwvQklDPgogICAgICAgICAgPC9GaW5JbnN0bklkPgogICAgICAgIDwvQ2R0ckFndD4KICAgICAgICA8Q2R0cj4KICAgICAgICAgIDxObT5ERUYgRWxlY3Ryb25pY3M8L05tPgogICAgICAgICAgPFBzdGxBZHI+CiAgICAgICAgICAgIDxBZHJMaW5lPkNvcm4gRXhjaGFuZ2UgNXRoIEZsb29yPC9BZHJMaW5lPgogICAgICAgICAgICA8QWRyTGluZT5NYXJrIExhbmUgNTU8L0FkckxpbmU+CiAgICAgICAgICAgIDxBZHJMaW5lPkVDM1I3TkUgTG9uZG9uPC9BZHJMaW5lPgogICAgICAgICAgICA8QWRyTGluZT5HQjwvQWRyTGluZT4KICAgICAgICAgIDwvUHN0bEFkcj4KICAgICAgICA8L0NkdHI+CiAgICAgICAgPENkdHJBY2N0PgogICAgICAgICAgPElkPgogICAgICAgICAgICA8T3Rocj4KICAgICAgICAgICAgICA8SWQ+MjM2ODM3MDc5OTQxMjU8L0lkPgogICAgICAgICAgICA8L090aHI+CiAgICAgICAgICA8L0lkPgogICAgICAgIDwvQ2R0ckFjY3Q+CiAgICAgICAgPFB1cnA+CiAgICAgICAgICA8Q2Q+Q0lOVjwvQ2Q+CiAgICAgICAgPC9QdXJwPgogICAgICAgIDxSbXRJbmY+CiAgICAgICAgICA8U3RyZD4KICAgICAgICAgICAgPFJmcmREb2NJbmY+CiAgICAgICAgICAgICAgPE5iPjQ1NjI8L05iPgogICAgICAgICAgICAgIDxSbHRkRHQ+MjAwOS0wOS0wODwvUmx0ZER0PgogICAgICAgICAgICA8L1JmcmREb2NJbmY+CiAgICAgICAgICA8L1N0cmQ+CiAgICAgICAgPC9SbXRJbmY+CiAgICAgIDwvQ2R0VHJmVHhJbmY+CiAgICAgIDxDZHRUcmZUeEluZj4KICAgICAgICA8UG10SWQ+CiAgICAgICAgICA8SW5zdHJJZD5BQkMvMDkwNjI4L0NDVDAwMS8yPC9JbnN0cklkPgogICAgICAgICAgPEVuZFRvRW5kSWQ+QUJDL0FCQy0xMzY3OS8yMDA5LTA5LTE1PC9FbmRUb0VuZElkPgogICAgICAgIDwvUG10SWQ+CiAgICAgICAgPEFtdD4KICAgICAgICAgIDxFcXZ0QW10PgogICAgICAgICAgICA8QW10IENjeT0iRVVSIj41MDAwMDA8L0FtdD4KICAgICAgICAgICAgPENjeU9mVHJmPlVTRDwvQ2N5T2ZUcmY+CiAgICAgICAgICA8L0VxdnRBbXQ+CiAgICAgICAgPC9BbXQ+CiAgICAgICAgPENocmdCcj5DUkVEPC9DaHJnQnI+CiAgICAgICAgPENkdHJBZ3Q+CiAgICAgICAgICA8RmluSW5zdG5JZD4KICAgICAgICAgICAgPEJJQz5EREREQkVCQjwvQklDPgogICAgICAgICAgPC9GaW5JbnN0bklkPgogICAgICAgIDwvQ2R0ckFndD4KICAgICAgICA8Q2R0cj4KICAgICAgICAgIDxObT5HSEkgU2VtaWNvbmR1Y3RvcnM8L05tPgogICAgICAgICAgPFBzdGxBZHI+CiAgICAgICAgICAgIDxTdHJ0Tm0+QXZlbnVlIEJydWdtYW5uPC9TdHJ0Tm0+CiAgICAgICAgICAgIDxCbGRnTmI+NDE1PC9CbGRnTmI+CiAgICAgICAgICAgIDxQc3RDZD4xMTgwPC9Qc3RDZD4KICAgICAgICAgICAgPFR3bk5tPkJydXNzZWxzPC9Ud25ObT4KICAgICAgICAgIDwvUHN0bEFkcj4KICAgICAgICA8L0NkdHI+CiAgICAgICAgPENkdHJBY2N0PgogICAgICAgICAgPElkPgogICAgICAgICAgICA8SUJBTj5CRTMwMDAxMjE2MzcxNDExPC9JQkFOPgogICAgICAgICAgPC9JZD4KICAgICAgICA8L0NkdHJBY2N0PgogICAgICAgIDxJbnN0ckZvckNkdHJBZ3Q+CiAgICAgICAgICA8Q2Q+UEhPQjwvQ2Q+CiAgICAgICAgICA8SW5zdHJJbmY+KzMyLzIvMjIyMjIyMjwvSW5zdHJJbmY+CiAgICAgICAgPC9JbnN0ckZvckNkdHJBZ3Q+CiAgICAgICAgPFB1cnA+CiAgICAgICAgICA8Q2Q+R0REUzwvQ2Q+CiAgICAgICAgPC9QdXJwPgogICAgICAgIDxSbXRJbmY+CiAgICAgICAgICA8U3RyZD4KICAgICAgICAgICAgPFJmcmREb2NJbmY+CiAgICAgICAgICAgICAgPFRwPgogICAgICAgICAgICAgICAgPENkT3JQcnRyeT4KICAgICAgICAgICAgICAgICAgPENkPkNJTlY8L0NkPgogICAgICAgICAgICAgICAgPC9DZE9yUHJ0cnk+CiAgICAgICAgICAgICAgPC9UcD4KICAgICAgICAgICAgICA8TmI+QUJDLTEzNjc5PC9OYj4KICAgICAgICAgICAgICA8Umx0ZER0PjIwMTUtMTEtMjk8L1JsdGREdD4KICAgICAgICAgICAgPC9SZnJkRG9jSW5mPgogICAgICAgICAgPC9TdHJkPgogICAgICAgIDwvUm10SW5mPgogICAgICA8L0NkdFRyZlR4SW5mPgogICAgICA8Q2R0VHJmVHhJbmY+CiAgICAgICAgPFBtdElkPgogICAgICAgICAgPEluc3RySWQ+QUJDLzA5MDkyOC9DQ1QwMDEvMzwvSW5zdHJJZD4KICAgICAgICAgIDxFbmRUb0VuZElkPkFCQy85ODctQUMvMjAwOS0wOS0yNzwvRW5kVG9FbmRJZD4KICAgICAgICA8L1BtdElkPgogICAgICAgIDxBbXQ+CiAgICAgICAgICA8SW5zdGRBbXQgQ2N5PSJVU0QiPjEwMDAwMDA8L0luc3RkQW10PgogICAgICAgIDwvQW10PgogICAgICAgIDxDaHJnQnI+U0hBUjwvQ2hyZ0JyPgogICAgICAgIDxDZHRyQWd0PgogICAgICAgICAgPEZpbkluc3RuSWQ+CiAgICAgICAgICAgIDxCSUM+QkJCQlVTNjY8L0JJQz4KICAgICAgICAgIDwvRmluSW5zdG5JZD4KICAgICAgICA8L0NkdHJBZ3Q+CiAgICAgICAgPENkdHI+CiAgICAgICAgICA8Tm0+U2lsaWNvbiBJTkM8L05tPgogICAgICAgICAgPFBzdGxBZHI+CiAgICAgICAgICAgIDxEZXB0PlRyZWFzdXJ5IGRlcGFydG1lbnQ8L0RlcHQ+CiAgICAgICAgICAgIDxTdHJ0Tm0+QnVzaCBTdHJlZXQ8L1N0cnRObT4KICAgICAgICAgICAgPEJsZGdOYj4xMzwvQmxkZ05iPgogICAgICAgICAgICA8UHN0Q2Q+Q0EgOTQxMDg8L1BzdENkPgogICAgICAgICAgICA8VHduTm0+U2FuIEZyYW5jaXNjbzwvVHduTm0+CiAgICAgICAgICAgIDxDdHJ5PlVTPC9DdHJ5PgogICAgICAgICAgPC9Qc3RsQWRyPgogICAgICAgIDwvQ2R0cj4KICAgICAgICA8Q2R0ckFjY3Q+CiAgICAgICAgICA8SWQ+CiAgICAgICAgICAgIDxPdGhyPgogICAgICAgICAgICAgIDxJZD40ODk1NjIzPC9JZD4KICAgICAgICAgICAgPC9PdGhyPgogICAgICAgICAgPC9JZD4KICAgICAgICA8L0NkdHJBY2N0PgogICAgICAgIDxQdXJwPgogICAgICAgICAgPENkPklOVEM8L0NkPgogICAgICAgIDwvUHVycD4KICAgICAgICA8Um10SW5mPgogICAgICAgICAgPFN0cmQ+CiAgICAgICAgICAgIDxSZnJkRG9jSW5mPgogICAgICAgICAgICAgIDxUcD4KICAgICAgICAgICAgICAgIDxDZE9yUHJ0cnk+CiAgICAgICAgICAgICAgICAgIDxDZD5DSU5WPC9DZD4KICAgICAgICAgICAgICAgIDwvQ2RPclBydHJ5PgogICAgICAgICAgICAgIDwvVHA+CiAgICAgICAgICAgICAgPE5iPjk4Ny1BQzwvTmI+CiAgICAgICAgICAgICAgPFJsdGREdD4yMDE1LTExLTI5PC9SbHRkRHQ+CiAgICAgICAgICAgIDwvUmZyZERvY0luZj4KICAgICAgICAgIDwvU3RyZD4KICAgICAgICA8L1JtdEluZj4KICAgICAgPC9DZHRUcmZUeEluZj4KICAgIDwvUG10SW5mPgogIDwvQ3N0bXJDZHRUcmZJbml0bj4KPC9Eb2N1bWVudD4K</ds:Object></ds:Signature>

however cannot verify the same using node.js version 8.9 with the openssl crypto engine. Something about the eliptci curve not being found? any ideas why they would be different? does open ssl use a differnent naming from the ec ?

microshine commented 6 years ago

@Alttaf Can you check this script. It works for me

// @ts-check
const xades = require("xadesjs");
const Crypto = require("node-webcrypto-ossl");

xades.Application.setEngine("OpenSSL", new Crypto());

const xml = `<?xml version="1.0" encoding="UTF-8"?><ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#" Id="1515159712853"><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#ecdsa-sha256"/><ds:Reference Id="HVE-A04C" Type="http://www.w3.org/2000/09/xmldsig#Object" URI="#o_HVE-A04C"><ds:Transforms><ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#base64"/></ds:Transforms><ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/><ds:DigestValue>HpX/S7hxefbA9QVC1nkiVm2LDesYtnXd7kSYExa7sWU=</ds:DigestValue></ds:Reference><ds:Reference Type="http://uri.etsi.org/01903#SignedProperties" URI="#xades-id-1515159712853"><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>34ppnIRMCSgZ1OOJiCFVyC/4RtMmdSku9GVjZXAt8co=</ds:DigestValue></ds:Reference></ds:SignedInfo><ds:SignatureValue Id="value-1515159712853">HfFMx+ImtdufDGdECbIfoJJMuhTz351PvEjdUQz/NtSvpDBCbQeh+3tnQnrjDTKtrv5qxLgMhP4E8X7Vd9GlYTy8/V/nI1TandaAfHOGFuNQyB1rDHnvkMKc5Ftc6LBP</ds:SignatureValue><ds:KeyInfo><ds:X509Data><ds:X509Certificate>MIIF4zCCA8ugAwIBAgIQG2CRCTTS1bpaONN/VI6ykTANBgkqhkiG9w0BAQsFADBjMQswCQYDVQQGEwJFRTEiMCAGA1UECgwZQVMgU2VydGlmaXRzZWVyaW1pc2tlc2t1czEXMBUGA1UEYQwOTlRSRUUtMTA3NDcwMTMxFzAVBgNVBAMMDkVTVEVJRC1TSyAyMDE1MB4XDTE3MTIxOTA4NTMxOVoXDTIwMDUxMTIwNTk1OVowgbUxCzAJBgNVBAYTAkVFMSQwIgYDVQQKDBtFU1RFSUQgKERJR0ktSUQgRS1SRVNJREVOVCkxGjAYBgNVBAsMEWRpZ2l0YWwgc2lnbmF0dXJlMScwJQYDVQQDDB5BREFNUyxNSUNIQUVMIEpPSE4sMzczMDUzMDAxMjMxDjAMBgNVBAQMBUFEQU1TMRUwEwYDVQQqDAxNSUNIQUVMIEpPSE4xFDASBgNVBAUTCzM3MzA1MzAwMTIzMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEtPokQFgrwL6cf66n0t3Bvio33geynl+IqxoPcOAhrOZfVnD+0o4YiAK60JSOsztJHMVid/d9G2LFFdX93doIffC5diHP6lAFWo6woxe54ElAhdribyzfFENBv6aO1Hpio4IB7DCCAegwCQYDVR0TBAIwADAOBgNVHQ8BAf8EBAMCBkAwVAYDVR0gBE0wSzA+BgkrBgEEAc4fAQIwMTAvBggrBgEFBQcCARYjaHR0cHM6Ly93d3cuc2suZWUvcmVwb3NpdG9v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GpnHiKSaz4VKg3xWKKghbJiy7giXRig1lQQHb1yCz0pjsMgd9sktc3MoO4/OHEahrtohj08PYdDX2F9Xl8+6dPW2RNBuOILCDELoEH7IWKMfTsTJZFDbM4IhsjV/90Oj2F3JI4wbTn6JrM+mnv52KxTwxw1IyIII5DhcHxVo=</ds:X509Certificate></ds:X509Data></ds:KeyInfo><ds:Object><xades:QualifyingProperties xmlns:xades="http://uri.etsi.org/01903/v1.3.2#" Target="#1515159712853"><xades:SignedProperties Id="xades-id-1515159712853"><xades:SignedSignatureProperties><xades:SigningTime>2018-01-05T13:41:52.856Z</xades:SigningTime><xades:SigningCertificateV2><xades:Cert><xades:CertDigest><ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/><ds:DigestValue>TRTdfSn2Jqz0WG0LlsLxUkDkQfw=</ds:DigestValue></xades:CertDigest></xades:Cert></xades:SigningCertificateV2></xades:SignedSignatureProperties><xades:SignedDataObjectProperties><xades:DataObjectFormat ObjectReference="#HVE-A04C"><xades:MimeType>text/xml</xades:MimeType></xades:DataObjectFormat><xades:CommitmentTypeIndication><xades:CommitmentTypeId><xades:Identifier>http://uri.etsi.org/01903/v1.2.2#ProofOfApproval</xades:Identifier></xades:CommitmentTypeId><xades:AllSignedDataObjects/></xades:CommitmentTypeIndication></xades:SignedDataObjectProperties></xades:SignedProperties></xades:QualifyingProperties></ds:Object><ds:Object Id="o_HVE-A04C">PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPERvY3VtZW50IHhtbG5zOnhzaT0iaHR0cDovL3d3dy53My5vcmcvMjAwMS9YTUxTY2hlbWEtaW5zdGFuY2UiIHhtbG5zPSJ1cm46aXNvOnN0ZDppc286MjAwMjI6dGVjaDp4c2Q6cGFpbi4wMDEuMDAxLjAzIj4KICA8Q3N0bXJDZHRUcmZJbml0bj4KICAgIDxHcnBIZHI+CiAgICAgIDxNc2dJZD5BQkMvMDkwOTI4L0NDVDAwMTwvT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ICAgPElkPgogICAgICAgICAgPE90aHI+CiAgICAgICAgICAgIDxJZD4wMDEyNTU3NDk5OTwvSWQ+CiAgICAgICAgICA8L090aHI+CiAgICAgICAgPC9JZD4KICAgICAgPC9EYnRyQWNjdD4KICAgICAgPERidHJBZ3Q+CiAgICAgICAgPEZpbkluc3RuSWQ+CiAgICAgICAgICA8QklDPkJCQkJVUzMzPC9CSUM+CiAgICAgICAgPC9GaW5JbnN0bklkPgogICAgICA8L0RidHJBZ3Q+CiAgICAgIDxDZHRUcmZUeEluZj4KICAgICAgICA8UG10SWQ+CiAgICAgICAgICA8SW5zdHJJZD5BQkMvMDkwOTI4L0NDVDAwMS8wMTwvSW5zdHJJZD4KICAgICAgICAgIDxFbmRUb0VuZElkPkFCQy80NTYyLzIwMDktMDktMDg8L0VuZFRvRW5kSWQ+CiAgICAgICAgPC9QbXRJZD4KICAgICAgICA8QW10PgogICAgICAgICAgPEluc3RkQW10IENjeT0iSlBZIj4xMDAwMDAwMDwvSW5zdGRBbXQ+CiAgICAgICAgPC9BbXQ+CiAgICAgICAgPENocmdCcj5TSEFSPC9DaHJnQnI+CiAgICAgICAgPENkdHJBZ3Q+CiAgICAgICAgICA8RmluSW5zdG5JZD4KICAgICAgICAgICAgPEJJQz5BQUFBR0IyTDwvQklDPgogICAgICAgICAgPC9GaW5JbnN0bklkPgogICAgICAgIDwvQ2R0ckFndD4KICAgICAgICA8Q2R0cj4KICAgICAgICAgIDxObT5ERUYgRWxlY3Ryb25pY3M8L05tPgogICAgICAgICAgPFBzdGxBZHI+CiAgICAgICAgICAgIDxBZHJMaW5lPkNvcm4gRXhjaGFuZ2UgNXRoIEZsb29yPC9BZHJMaW5lPgogICAgICAgICAgICA8QWRyTGluZT5NYXJrIExhbmUgNTU8L0FkckxpbmU+CiAgICAgICAgICAgIDxBZHJMaW5lPkVDM1I3TkUgTG9uZG9uPC9BZHJMaW5lPgogICAgICAgICAgICA8QWRyTGluZT5HQjwvQWRyTGluZT4KICAgICAgICAgIDwvUHN0bEFkcj4KICAgICAgICA8L0NkdHI+CiAgICAgICAgPENkdHJBY2N0PgogICAgICAgICAgPElkPgogICAgICAgICAgICA8T3Rocj4KICAgICAgICAgICAgICA8SWQ+MjM2ODM3MDc5OTQxMjU8L0lkPgogICAgICAgICAgICA8L090aHI+CiAgICAgICAgICA8L0lkPgogICAgICAgIDwvQ2R0ckFjY3Q+CiAgICAgICAgPFB1cnA+CiAgICAgICAgICA8Q2Q+Q0lOVjwvQ2Q+CiAgICAgICAgPC9QdXJwPgogICAgICAgIDxSbXRJbmY+CiAgICAgICAgICA8U3RyZD4KICAgICAgICAgICAgPFJmcmREb2NJbmY+CiAgICAgICAgICAgICAgPE5iPjQ1NjI8L05iPgogICAgICAgICAgICAgIDxSbHRkRHQ+MjAwOS0wOS0wODwvUmx0ZER0PgogICAgICAgICAgICA8L1JmcmREb2NJbmY+CiAgICAgICAgICA8L1N0cmQ+CiAgICAgICAgPC9SbXRJbmY+CiAgICAgIDwvQ2R0VHJmVHhJbmY+CiAgICAgIDxDZHRUcmZUeEluZj4KICAgICAgICA8UG10SWQ+CiAgICAgICAgICA8SW5zdHJJZD5BQkMvMDkwNjI4L0NDVDAwMS8yPC9JbnN0cklkPgogICAgICAgICAgPEVuZFRvRW5kSWQ+QUJDL0FCQy0xMzY3OS8yMDA5LTA5LTE1PC9FbmRUb0VuZElkPgogICAgICAgIDwvUG10SWQ+CiAgICAgICAgPEFtdD4KICAgICAgICAgIDxFcXZ0QW10PgogICAgICAgICAgICA8QW10IENjeT0iRVVSIj41MDAwMDA8L0FtdD4KICAgICAgICAgICAgPENjeU9mVHJmPlVTRDwvQ2N5T2ZUcmY+CiAgICAgICAgICA8L0VxdnRBbXQ+CiAgICAgICAgPC9BbXQ+CiAgICAgICAgPENocmdCcj5DUkVEPC9DaHJnQnI+CiAgICAgICAgPENkdHJBZ3Q+CiAgICAgICAgICA8RmluSW5zdG5JZD4KICAgICAgICAgICAgPEJJQz5EREREQkVCQjwvQklDPgogICAgICAgICAgPC9GaW5JbnN0bklkPgogICAgICAgIDwvQ2R0ckFndD4KICAgICAgICA8Q2R0cj4KICAgICAgICAgIDxObT5HSEkgU2VtaWNvbmR1Y3RvcnM8L05tPgogICAgICAgICAgPFBzdGxBZHI+CiAgICAgICAgICAgIDxTdHJ0Tm0+QXZlbnVlIEJydWdtYW5uPC9TdHJ0Tm0+CiAgICAgICAgICAgIDxCbGRnTmI+NDE1PC9CbGRnTmI+CiAgICAgICAgICAgIDxQc3RDZD4xMTgwPC9Qc3RDZD4KICAgICAgICAgICAgPFR3bk5tPkJydXNzZWxzPC9Ud25ObT4KICAgICAgICAgIDwvUHN0bEFkcj4KICAgICAgICA8L0NkdHI+CiAgICAgICAgPENkdHJBY2N0PgogICAgICAgICAgPElkPgogICAgICAgICAgICA8SUJBTj5CRTMwMDAxMjE2MzcxNDExPC9JQkFOPgogICAgICAgICAgPC9JZD4KICAgICAgICA8L0NkdHJBY2N0PgogICAgICAgIDxJbnN0ckZvckNkdHJBZ3Q+CiAgICAgICAgICA8Q2Q+UEhPQjwvQ2Q+CiAgICAgICAgICA8SW5zdHJJbmY+KzMyLzIvMjIyMjIyMjwvSW5zdHJJbmY+CiAgICAgICAgPC9JbnN0ckZvckNkdHJBZ3Q+CiAgICAgICAgPFB1cnA+CiAgICAgICAgICA8Q2Q+R0REUzwvQ2Q+CiAgICAgICAgPC9QdXJwPgogICAgICAgIDxSbXRJbmY+CiAgICAgICAgICA8U3RyZD4KICAgICAgICAgICAgPFJmcmREb2NJbmY+CiAgICAgICAgICAgICAgPFRwPgogICAgICAgICAgICAgICAgPENkT3JQcnRyeT4KICAgICAgICAgICAgICAgICAgPENkPkNJTlY8L0NkPgogICAgICAgICAgICAgICAgPC9DZE9yUHJ0cnk+CiAgICAgICAgICAgICAgPC9UcD4KICAgICAgICAgICAgICA8TmI+QUJDLTEzNjc5PC9OYj4KICAgICAgICAgICAgICA8Umx0ZER0PjIwMTUtMTEtMjk8L1JsdGREdD4KICA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PgogICAgICAgICAgICAgIDxJZD40ODk1NjIzPC9JZD4KICAgICAgICAgICAgPC9PdGhyPgogICAgICAgICAgPC9JZD4KICAgICAgICA8L0NkdHJBY2N0PgogICAgICAgIDxQdXJwPgogICAgICAgICAgPENkPklOVEM8L0NkPgogICAgICAgIDwvUHVycD4KICAgICAgICA8Um10SW5mPgogICAgICAgICAgPFN0cmQ+CiAgICAgICAgICAgIDxSZnJkRG9jSW5mPgogICAgICAgICAgICAgIDxUcD4KICAgICAgICAgICAgICAgIDxDZE9yUHJ0cnk+CiAgICAgICAgICAgICAgICAgIDxDZD5DSU5WPC9DZD4KICAgICAgICAgICAgICAgIDwvQ2RPclBydHJ5PgogICAgICAgICAgICAgIDwvVHA+CiAgICAgICAgICAgICAgPE5iPjk4Ny1BQzwvTmI+CiAgICAgICAgICAgICAgPFJsdGREdD4yMDE1LTExLTI5PC9SbHRkRHQ+CiAgICAgICAgICAgIDwvUmZyZERvY0luZj4KICAgICAgICAgIDwvU3RyZD4KICAgICAgICA8L1JtdEluZj4KICAgICAgPC9DZHRUcmZUeEluZj4KICAgIDwvUG10SW5mPgogIDwvQ3N0bXJDZHRUcmZJbml0bj4KPC9Eb2N1bWVudD4K</ds:Object></ds:Signature>`

async function main() {
    const signedDocument = xades.Parse(xml);
    var xmlSignature = signedDocument.getElementsByTagNameNS("http://www.w3.org/2000/09/xmldsig#", "Signature");

    var signedXml = new xades.SignedXml(signedDocument);
    signedXml.LoadXml(xmlSignature[0]);
    const ok = await signedXml.Verify();
    console.log(ok); // true
}

main()
    .catch((err) => {
        console.error(err);
    });