vbuch / node-signpdf

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

Invalid signature on Adobe Reader: "signer's identity has not yet been verified" #111

Closed dody87 closed 3 years ago

dody87 commented 3 years ago

I've tried with several p12 certificates and when I sign via my Nodejs approach it returns an invalid signature on Adobe.

Screen Shot 2020-12-16 at 19 28 43

However, signing just with Adobe the signature seems to be valid (just with a warning).

Screen Shot 2020-12-16 at 19 29 27

Is there something that I'm missing?

` const signer = require('node-signpdf') const fs = require('fs') const helpers = require('node-signpdf/dist/helpers')

const init = async () => { const p12Buffer = fs.readFileSync(${__dirname}/cert.p12);

let pdfBuffer = fs.readFileSync(`${__dirname}/test.pdf`);
pdfBuffer = helpers.plainAddPlaceholder({
    pdfBuffer,
    signatureLength: 3224,
});

pdfBuffer = signer.default.sign(pdfBuffer, p12Buffer, {
    passphrase: 'reingenio'
});

fs.writeFileSync(`${__dirname}/signed.pdf`, pdfBuffer)

}

init() `

Thanks.

inane commented 3 years ago

Same problem here , news from your side?

LuanMaik commented 3 years ago

Check this: https://github.com/vizicsaba89/pdf-signer/issues/22

inane commented 3 years ago

Check this: vizicsaba89/pdf-signer#22

Yes, I checked that link some weeks ago, even I contacted with the guy. No news.

FranckDepoortere commented 3 years ago

Hello,

If we use a certificate with English description, without accented characters, it works for us. We encounter the same issue with Spanish certificates containing accented characters. Actually in most of cases, languages like Spanish, or other latin languages often contains accented characters within the certificate. Example in Spanish: "CN = AC Representación" In consequence, the signature doesn't work for these latin languages.

We are blocked. Thanks in advance you for your help Franck

bopos commented 3 years ago

Hello, I use directly the p12 (binary) file and I have the same issue when the certificate include accented characters

import signer from 'node-signpdf';
...
const signedPdf = signer.sign(
  fs.readFileSync(PATH_TO_PDF_FILE)
  fs.readFileSync(PATH_TO_P12_CERTIFICATE),
);
FranckDepoortere commented 3 years ago

Hello,

Apparently, the bug is not located in the library 'node-signpdf', but on 'forge' lib.

This PR fixed our issue: https://github.com/digitalbazaar/forge/pull/731/files (@bopos found this) Unfortunately, this PR has not been merged yet. It has been created in nov 2019. Thank you anyway. Franck

stale[bot] commented 3 years 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.

Arturokin commented 3 years ago

any update on this? i'm having de the same issue