I’ve created a document with a PADES approval signature, which works fine, when digitally signed, but fails when i try add a DocMDP dictionary to turn the first signature into a certification/Author signature. (documents linked below)
Approval Signature
This first document shows the approval signature which is validating..
Certification Signature
The second document is a certification signature.. i’ve added a DocMDP dictionary to the document and copied the first signature dictionary into that.
Both DER encoded signer objects are the same in both sigs.
What i’m trying to achieve
This is an Adobe certification signature.. my PDF dictionary structure is the same as that and everything looks the same.
The issue (maybe)
I think my issue might be to do with the ByteRange i sign. With the Approval signature the ByteRang is 0 to the start of the /Contents signature field, which when captured contains a default byte range placeholder. Then from the end of the contents to the end of the file.. [0, 11347, 31349, 4448]
But when adding a DocMDP, because the byteRang is 4 digits, and the /contents default placeholder has been duplicated to the DocMDP, the creation signature ByteRange includes the full contents of the default byte range in there, which obviously changes when replaced with the signature object after signing.. [0, 11361, 31363, 24958]
I’ve tried using a six digit ByteRange to bypass the DocMDP contents field as well but that didnt work, and also the correctly signed Adobe document only uses 4 digits. I can’t find any info on how to get around this and what the ByteRange should cover in this situation. This is the Adobe document’s DocMDP dictionary i’m referencing, which you can see the last digit is a lot smaller..
Reference documents
- Signed with Approval
- Signed with Certification
- Signed Adobe document
1