Junaid Sarfraz

Junaid Sarfraz

  • 1.7k
  • 9
  • 217

Signature Mismatch Issue with XML Sig Verification (xades) in java

Aug 17 2024 6:27 AM

I'm facing an issue with XML signature verification and need some help debugging my code.

I have three key classes, my signature didn't verified i am also new to java and tried everything but no success. what is my mistake? how to correct my code so that signature can be verified and generated against xml. ISO 20022 xml format shall be digitally signed and verified from below code

<Document xmlns="urn:iso:std:iso:20022:tech:xsd:pain.001.001.03">
<AppHdr><Fr><FIId><FinInstnId><BICFI>ABCDEFGHIJKL</BICFI></FinInstnId></FIId></Fr><To><FIId><FinInstnId><BICFI>MNOPQRSTUVWXYZ</BICFI></FinInstnId></FIId></To><BizMsgIdr>Message123</BizMsgIdr><MsgDefIdr>abcd.1234</MsgDefIdr><CreDt>2024-08-15T12:00:00Z</CreDt></AppHdr>
</Document>
  1. XadesSigner (CREATE SIGNATURE)
  2. XadesSignatureVerifier (verify signature)
  3. NoUriDereferencer.java (implemented custom URIDereferencer)

verfifier logs

Dereferencing URI: #_f838896a-be99-44a1-8b37-af12e079be08
Dereferencing URI: #_98ff15ed-7328-4241-abd0-67021d18488f-signedprops
URI is null or not found in map: com.ibm.xml.crypto.dsig.dom.ReferenceImpl@b0cf108f
Using data for null URI: javax.xml.crypto.OctetStreamData@982a8d94
Core Validation Status: false
Signature failed core validation
Signature validation status: true
Reference validity status: true, Reference URI: [#_f838896a-be99-44a1-8b37-af12e079be08]
Reference validity status: true, Reference URI: [#_98ff15ed-7328-4241-abd0-67021d18488f-signedprops]
Reference validity status: false, Reference URI: [null]
Signature is invalid.

Answers (1)