Closed Gonzalosanto closed 2 years ago
Maybe someone can try this way if it's worth it. but the case here I make my own certificate.
const p12Buffer = fs.readFileSync( path.join(__dirname, "../utils/test.pfx") ); const pdfBuffer = fs.readFileSync(
${url}/${file}); const obj = "[name: 'test1', createdAt: '27/05/2021']"; const dataReason = JSON.stringify(obj); const pdfWithPlaceholder = plainAddPlaceholder({ pdfBuffer, reason: dataReason, }); const signedPdf = signer.sign(pdfWithPlaceholder, p12Buffer, { passphrase: "test", }); fs.writeFileSync("test.pdf", signedPdf);
This is where finding happens: https://github.com/vbuch/node-signpdf/blob/7ebdec0afa4b0fea0e287164d5cbe78335c890b5/src/signpdf.js#L113 You could try and debug in there to see why and where it messes up. I was doubtful when this was implemented, but it worked for our usecases so I had no reason to dig deeper. Would love to see your usecase but reality is that having the bundles that break it, you are the only one who can debug it @Gonzalosanto
Latest version fix this @vbuch ?
Doubt that @inane. There was no PR on the topic.
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.
Describe the bug and the expected behaviour When I'm running this script:
Returns me an error saying:
SignPdfError: Failed to find a certificate that matches the private key.
My code is supposed to sign the pdf which has a placeholder with the bundle I generated from a chain of PEM certificates.
If I use a self signed certificate does not give any trouble. But with a certificate issued by a CA and signed with CA private key gets me this error.
Do you have any idea or workaround about this problem?
The documentation and tests are not so clear to understand why happens this.