vbuch / node-signpdf

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

Different Digital Signature section on PDF file #180

Closed rossinicolas closed 11 months ago

rossinicolas commented 1 year ago

Hi @vbuch , now a day, i'm using FortifyApp client in our web application to access to Token certificate that i'm using to sign the PDF files. Previously, i'm adding placeholder with node-signpdf library (plainAddPlaceholder helper). we are making multiple signatures in this way, without any ploblem, but, if i use an external tools to add a new sign, like xolidosign, CryptoId or other similar the /Type/Sig section had different order than the produced by node-signpdf. There's an example of the issue that i have:

summary, /Contents tag is in different order, so, depending on the method used, acrobat is show me all the sign or just the last one. TIA.

vbuch commented 1 year ago

Thou you are not asking any question, I think this answers them: https://github.com/vbuch/node-signpdf/blob/cef8915064d3862e2e08f5fa9e6e09687a468d42/README.md?plain=1#L61

Here is where this requirement comes from: https://github.com/vbuch/node-signpdf/blob/4cedc49fffa4d4bbac2bd855b78555a9cff64e4d/src/signpdf.js#L57

Basically, because we are not parsing anything as a structure from the file, but just moving a cursor withing strings, we introduce that limitation. If you want this to work, you would have to rework it not to do findByteRange() but rather get the whole Sig as a structure and work with it.

As usually, PRs are welcome.

rossinicolas commented 1 year ago

Thou you are not asking any question, I think this answers them:

https://github.com/vbuch/node-signpdf/blob/cef8915064d3862e2e08f5fa9e6e09687a468d42/README.md?plain=1#L61

Here is where this requirement comes from:

https://github.com/vbuch/node-signpdf/blob/4cedc49fffa4d4bbac2bd855b78555a9cff64e4d/src/signpdf.js#L57

Basically, because we are not parsing anything as a structure from the file, but just moving a cursor withing strings, we introduce that limitation. If you want this to work, you would have to rework it not to do findByteRange() but rather get the whole Sig as a structure and work with it.

As usually, PRs are welcome.

Yes, i understood the Requirement but i don't know why that's different than a pdf files signed using Acrobat Reader for example. That's a big problem in our implementation bacause if an enduser upload a file firstly signed by Acrobat and make a second Sign using node-signpdf, the pdf file just show me the last Sign when i open it in Acrobat, losing the first one.

stale[bot] commented 1 year 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.