Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

XML SIGNATURE

Avatar

Level 4

How exactly can i add xml signatures in my form ? Also if my form contain 100 fields , is there a generic way by which i can get the data from all the fields.

Thanks

6 Replies

Avatar

Former Community Member

The XML gets signed when the data is submitted.  You need to use LiveCycle Designer ES and add a submit button to your form.  Configure the button to submit XML Data or XDP, and then enable the "Sign Submission" property (found on the "Submit" tab.

When the submit button is clicked, you will be prompted to pick the digital certificate (credential) to be used to create the signature.

Regards

Steve

Avatar

Level 4

Sorry there . I forgot to mention that i wont be using any button on my form and i wish to generate Xml signature may be at the presign of the signature field. And my form has approx 100 fields so i was looking for a generic way by which i can extarct the values of all the fields.

var

oList= xfa.data.datasets.resolveNodes("$data.form1.TextField1");

var

oOtherNode = xfa.data.datasets.resolveNode("$data.form1.TextField2");

oList.append(oOtherNode);

xfa.signature.sign(oList ,

"$data.signatures","100");

This is the code which i was trying to use . But its not working dunno why

Thanks

Avatar

Former Community Member

If you want to get all of the data inside of a script then you can use this command:

xfa.datasets.data.saveXML("pretty");

If you want to save the data to a file then use this command:

xfa.host.exportData("", true);

This wil bring up a dialog and allow you to choose the filename of the xml file you want to save. Note that you cannot save the file without the dialog.

Paul

Avatar

Former Community Member

When using XML Dig Sig to sign the XML data or XDP (XML Data Package) there is no visual representation (i.e. Signature Field) of the signature like there is with a PDF signature.

I believe It may be possible to generate an XML DigSig without a submit button (as I mentioned in my previous post), but it don't believe it can be done on the preSign event of a PDF Signature field.  I will create a sample ond post it as soon as possible.

Regards

Steve

Avatar

Former Community Member

Hi Steve,


Thanks for your reply for this issue.


I have compared the xml schema generated by javascript and through submit button.


javascript for signature

xfa.signature.sign(this.parent.TextField1.dataNode, "$data.signatures", "mySignature");
var sigxml = xfa.datasets.data.signatures.saveXML();


If i passed both the signed xml for verify signature process then signature status is coming as false for xml generated by script and true for submit button.


I want to check data tampering with xml in my application. signature status will be the best option to check data tampering.


please find the xml schema from both the option and you may get the difference in xml generated as some values get missing in script genrated xml.


what is the way to reproduce same signed xml as of from submit button with javascript?


Please reply for this too.


Regards

Abhishek

This is signed xml generated by submit button.

<?xml version="1.0" encoding="UTF-8"?>
<xfa:data xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/"
><form1
><main1
><Amount
>888888888.00</Amount
><PayNo
>7777</PayNo
></main1
><SignerInfo xfa:dataNode="dataGroup"
/><UniqueReferenceNo
>RUSS0110201008541386940418200000</UniqueReferenceNo
></form1
><signatures
><Signature xmlns="http://www.w3.org/2000/09/xmldsig#" Id="datasignature_1"
><SignedInfo
><CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#WithComments"
/><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"
/><Reference URI="#id5662bdab" Type="http://www.w3.org/2000/09/xmldsig#SignatureProperties"
><Transforms
><Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#WithComments"
/></Transforms
><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"
/><DigestValue
>YDEJ0mdJxBk=</DigestValue
></Reference
><Reference URI=""
><Transforms
><Transform Algorithm="http://www.w3.org/2002/06/xmldsig-filter2"
><XPath xmlns="http://www.w3.org/2002/06/xmldsig-filter2" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#" Filter="intersect"
>here()/ancestor::dsig:Signature[1]/../../form1[1]//. |
here()/ancestor::dsig:Signature[1]/../../form1[1]//@* |
here()/ancestor::dsig:Signature[1]/../../form1[1]//namespace::*</XPath
></Transform
><Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#WithComments"
/></Transforms
><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"
/><DigestValue
>sj/JGvQtNpR4Z9YBI=</DigestValue
></Reference
></SignedInfo
><SignatureValue
>za0Uh08alHBd8JhclU6fKm6m9bCDxhQF8nETGcMvVGCYhaUxnxSaCcMcRsOPOCajc
i9GpA51lPsiyYTOlQj0=</SignatureValue
><KeyInfo
><X509Data
><X509Certificate
>MISK+6GhTxwIDAQABoyAwHjAPBgkqhkiG9y8BAQoEAgUAMAsG
A1UdDwQEAwIEkDANBgkqhkiG9w0BAQUFAAOBgQCd6/SXf6E4Dt632hJ1ShUhGJjMfyrwS2YJa6/z
w1mny1/gFNitalDPqlaM8bLKWg4f3IiKB/Nxvh/jD3LeX/yU8eOAaNhgP9zB6O2zZpF2ytm/kOKk
8LMz3r2hnF2ak0B6jkjpkqp6QFwOQ+i2n54RMh8B/Z5t8Njm5EJVZ2lMmw==</X509Certificate
></X509Data
></KeyInfo
><Object
><SignatureProperties Id="id5662bdab"
><SignatureProperty Target="datasignature_1"
><PROP_Sig xmlns="http://ns.adobe.com/pdf/2006" type="cabinet"
><M type="text"
>D:20101001085603+01'00'</M
><Name type="text"
>Nitin</Name
></PROP_Sig
></SignatureProperty
></SignatureProperties
></Object
></Signature
></signatures
></xfa:data
>

This is the signed xml generated by javascript as above

<?xml version="1.0" encoding="UTF-8"?>

<signatures
><Signature  Id="SignatureField1"
><SignedInfo
><CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#WithComments"
/><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"
/><Reference URI="#idcfb6b87b" Type="http://www.w3.org/2000/09/xmldsig#SignatureProperties"
><Transforms
><Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#WithComments"
/></Transforms
><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"
/><DigestValue
>aPZheqH7JE=</DigestValue
></Reference
><Reference URI=""
><Transforms
><Transform Algorithm="http://www.w3.org/2002/06/xmldsig-filter2"
><XPath Filter="intersect" xmlns="http://www.w3.org/2002/06/xmldsig-filter2" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#"
>here()/ancestor::dsig:Signature[1]/../../form1[1]/main1[1]/formdata[1]//. |
here()/ancestor::dsig:Signature[1]/../../form1[1]/main1[1]/formdata[1]//@* |
here()/ancestor::dsig:Signature[1]/../../form1[1]/main1[1]/formdata[1]//namespace::*</XPath
></Transform
><Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#WithComments"
/></Transforms
><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"
/><DigestValue
>J9PpL3DLDrjVE=</DigestValue
></Reference
></SignedInfo
><SignatureValue
>iKs30Iu3zHpvx0J8CWlkAwuFtq7ehVFh
/WQzvgBXQdn+tBFRo0A=</SignatureValue
><KeyInfo
><X509Data
><X509Certificate
>MIIjUWHsp1U1DxWUl2yB3mMLCXC8u4NZn1lj5N4ofdjwwNDxylTo
bZU8hedHbAFMesWRdInCM5jDWiAw/SK+6GhTxwIDAQABoyAwHjAPBgkqhkiG9y8BAQoEAgUAMAsG
A1UdDwQEAwIEkDANBgkqhkig4f3IiKw==</X509Certificate
></X509Data
></KeyInfo
><Object
><SignatureProperties Id="idcfb6b87b"
><SignatureProperty Target="SignatureField1"
><PROP_Sig xmlns="http://ns.adobe.com/pdf/2006" type="cabinet"
><M type="text"
>D:20101001085926+01'00'</M
><Name type="text"
>Nitin</Name
></PROP_Sig
></SignatureProperty
></SignatureProperties
></Object
></Signature
></signatures
>