vbuch / node-signpdf

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

[HELP] property 'publicKey' of 'certBags[i].cert' is null. #131

Closed amontero0611 closed 3 years ago

amontero0611 commented 3 years ago

Hi guys, I am stuck and would appreciate any help. I am getting the error above when trying to sign a document. This is my code:

pdf.on('end', () => {
    console.log("pdfDoc.end");
    let pdfBuffer = Buffer.concat(pdfChunks);
    let signedPDF = signer.sign(pdfBuffer, 
                  fs.readFileSync('identity.p12'), 
                  additionalOptions = {passphrase: 'kk-kk'}); 
    fs.writeFileSync('document.pdf', signedPDF);
});

And the error follows: ....\node_modules\node-signpdf\dist\signpdf.js:103 publicKey ^ TypeError: Cannot destructure property 'publicKey' of 'certBags[i].cert' as it is null.

Can someone please help figuring out what I am doing wrong? Thank you in advance.

amontero0611 commented 3 years ago

Got a possible answer: I am using ECDSA certificates (those provided by the Hyperledger Fabric CA) and they are not supported by node-forge. Will seek for an alternative. Closing the issue.

cw6365 commented 7 months ago

@amontero0611 did you ever find an alternative? thanks.