vbuch / node-signpdf

Simple signing of PDFs in node.
MIT License
719 stars 178 forks source link

p12 certificate expected as Buffer. #90

Closed erickximenes closed 4 years ago

erickximenes commented 4 years ago

I am bringing the certificate from the database, they are in base64, when it comes time to sign the PDF, it expects a buffer. What do I do?

Code to save the certificate to the database certificado: req.files.certificado.data.toString('base64'),

Code to sign const p12Buffer = await req.user.certificado; const signedPdf = signer.sign(output, p12Buffer, { passphrase: req.user.sen_cert });