Chilkat - Delphi DLL - XADES - CkXmlDSigGen_AddExternalTextRef

296 views Asked by At

I have a problem using the Ck XmlDSig Gen_AddExternalTextRef function. After signing, DigestValue always gets the same value for different URLs.

<ds:DigestValue>8ZRc1sGeVrPBx4lD717BgRaQekyh78QKV9SKsdt638U=</ds:DigestValue>

Where is the problem?

I can't find examples using the XmlDSig Gen_AddExternalTextRef function. Thank you for your help.

Marek

Code:

  .......................
  CkXmlDSigGen_AddExternalTextRef(xmlSigGen,PWideChar(url1),sbXml,'utf-8', true, 'sha256','');
  CkXmlDSigGen_SetRefIdAttr(xmlSigGen,PWideChar(url1),PWideChar(ref1));

  CkXmlDSigGen_AddExternalTextRef(xmlSigGen,PWideChar(url2),sbXml,'utf-8', true, 'sha256','');
  CkXmlDSigGen_SetRefIdAttr(xmlSigGen,PWideChar(url2),PWideChar(ref2));

  ................
  CkXmlDSigGen_CreateXmlDSigSb(xmlSigGen,sbXml);

Resulting XML:

<ds:Reference Id="xmldsig-fc9386fa-4c0d-42ba-bd4e-7ecb61218cfd-ref1" URI="https://isus.ezdrowie.gov.pl/fhir/Encounter/131544/_history/1">
  <ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
  <ds:DigestValue>8ZRc1sGeVrPBx4lD717BgRaQekyh78QKV9SKsdt638U=</ds:DigestValue>

</ds:Reference>
<ds:Reference Id="xmldsig-fc9386fa-4c0d-42ba-bd4e-7ecb61218cfd2" URI="https://isus.ezdrowie.gov.pl/fhir/Condition/131553/_history/1">
  <ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
  <ds:DigestValue>8ZRc1sGeVrPBx4lD717BgRaQekyh78QKV9SKsdt638U=</ds:DigestValue>
1

There are 1 answers

0
Chilkat Software On

Here's an example for adding external text data reference(s) and then verifying: https://www.example-code.com/delphiDll/xmldsig_external_text_reference.asp