vbuch / node-signpdf

Simple signing of PDFs in node.
MIT License
679 stars 176 forks source link

Sample code for PAdES LTV? #186

Open timotheeg opened 1 year ago

timotheeg commented 1 year ago

Would anyone have sample code to generate and inject a valid PAdES LTV signature (with cert chains, OCSP response, etc), in a pdf file ?

stale[bot] commented 11 months ago

This issue has been automatically marked as stale because it has not had activity in the past 90 days. It will be closed if no further activity occurs. Thank you for your contributions.

parallels999 commented 11 months ago

https://github.com/vbuch/node-signpdf/pull/116#issuecomment-843386087

vbuch commented 8 months ago

Just a note to anyone interested in implementing LTV:

This is where that starts: https://www.etsi.org/deliver/etsi_ts/102700_102799/10277804/01.01.01_60/ts_10277804v010101p.pdf

dhensby commented 7 months ago

I have done quite a bit of work to do LTV signatures, however they don't validate in acrobat because apparently the LTV signatures require a double signing of the document to be recognised as valid and I've not been able to get that working. This was a long time ago so I've forgotten the details and where I found the specification for LTV signatures in acrobat.

On the whole, the LTV signing is just about building up the CMS signature object to contain all the elements that are needed to perform offline signature validation. That means, creating the base signature and then including the revocation response objects too (OCSP, etc).

To do this I used @peculiar/asn1-cms (and others packages by them) to build the signature object.