Validating the iDIN Signature
The PAdES document with an iDIN Signature can be validated in the same manner as a document with an <a href=»https://devdoc.signant.eu/validating-embedded-signatures.html»>embedded AES</a>. The PDF document is signed by the DISP (Signant) on behalf of the Signatory, and will appear and validate as an ordinary PAdES document in the PDF reader.
The visual signature attributes
In the Adobe Reader – Signature Panel, you can inspect the details of each signature in a sequence of signatures.
Please note the Signature Details – Reason, as it contains relevant information on acting parts of the iDIN Signature:
A PAdES document with iDIN Signature
Signant embed a visible signature widget for each signatory. The signature widget is the only visible modification supported by the PAdES format enabling the document to be recognized as a signed document even if it is printed. The iDIN signature includes the following information:
The SAML assertion is the actual signatory AES part of the iDIN Signature. The assertion is however not suitable for being displayed in the Signature Panel. Instead it is attached in the same PDF document as an embedded file contained in the Document Dictionary entry «Signant.AttachedFiles».
The SAML assertion will provide the following data structure:
To view SAML assertion we need to:
1. Extract the SAML Response from the PDF Document Dictionary section:
Open the signed document in a text editor and locate the key «Signant.AttachedFiles». It should contain hexadecimal-encoded SAML data (content truncated for readability).
2. Convert the content from hexadecimal to Ascii format.
By copying and converting the hexadecimal content (i.e Signant.AttachedFiles <content>) to ASCII you will find the SAML response XML document, which in turn contains the SAML assertion.
In the SAML response some attributes are encrypted with AES keys which are encrypted with the DISP/Merchant private key. In order to make the validation of SAML response independent of DISP/merchant private key, the decrypted AES keys are also provided in the Signant.AttachedFiles section in json format.
Among the DecryptedAttributes please note the DocumentID together with the consumer attributes.
Validation of the SAML assertion
Validating the DocumentID (hash)
Now that we are able to validate the SAML assertion, we need to verify that it actually is related to the document in question. The DocumentID is the SHA256 hash value of the document to be signed. In a sequence of signatures the DocumentID will effectively bee identical to the SHA256 hash value of the document including the previous signature. To provide a reference point for the first signatory, the document is initially signed by a single time stamp. This initial time stamp serve as the previous signature for thee first signatory.
Signature sequence with 2 signatures
Validating the DocumentID in the first signature SAML assertion is a matter of calculation the hash of the time stamped edition and prove it identical to the DocumentID recorded in the assertion.
Procedure to validate the DocumentID
In Adobe Reader open the signature panel and right click on the initial time stamp. Select «View Signed Version» and save this version to a separate file (e.g initial.pdf).
Signature panel in Adobe Reader. View and save the signed version.
The SHA256 hash value of the extracted file can calculated using the certutil command-line utility like this:
Comparing the DocumentID in the SAML assertion and the calculated SHA256 hash value from the initial document:
The two identical values proves that the iDIN Signature is infact tied to this document. This procedure can be repeated for each signatory in the sequence of signatories calculating the SHA256 hash value from the previous signed version.