vbuch / node-signpdf

Simple signing of PDFs in node.
MIT License
700 stars 175 forks source link

Fix the regex that extract the signature from PDF Buffer #23

Closed eduBKR closed 5 years ago

eduBKR commented 5 years ago

I tried to verify some the signature of PDFs, and it fails when trying to extract the signature form the files. I make some tests with many files and I notice the ByteRange has, in some cases, an empty space at the end of the ByteRange, like this:

/ByteRange [0 79529 95531 2230 ]

And to make work properly with this case, the regex that gets the match, need to be modified to something like this:

/\/ByteRange \[(\d+) +(\d+) +(\d+) +(\d+)\s?\]/

If You want, I can make a PR with the fix, it's a simple thing, but it will help me a lot.

vbuch commented 5 years ago

Indeed that is valid. Not sure if I will have the time to makebthe change. Please, PR.

vbuch commented 5 years ago

Btw, I am planning to remove (or move out) verification from this package for future versions. It may be moved to a separate package. But verificaation is quite more complex than what is available in the package and needs separate attention.

vbuch commented 5 years ago

This has been fixed in the extractSignature of 1.0.0 and 0.3.2. Signature verification is no longer part of the package as of 1.0.0.