RichardBray / pdf_sign

🖋 Using node-signpdf and pdf-lib.js to sign a pdf
https://www.youtube.com/playlist?list=PLiKs97d-BatHWLh9MYrKwA9g6CD8RvAO3
39 stars 18 forks source link

At least one signature is invalid. #4

Open yiyasha15 opened 1 year ago

yiyasha15 commented 1 year ago

I'm trying to use this project to sign medical data[pdf] with (.pfx file and password) provided by the hospital.

Screenshot 2023-03-22 at 4 44 41 PM

But I get this error with the export file. If I use my own .p12 file I get the correct result, like in the tutorial. But using the (.pfx file and password) i created .p12 file. If i pass that.

Gives this error. Has someone tried different .p12 file? Please help. Thanks in advance. :)

RichardBray commented 1 year ago

Hello, I haven't tried it with a .pfx file. I'll need to look into what the differences between that and a .p12 are. I know it's possible to convert one to another so I don't know why it didn't work for you 🤔

yiyasha15 commented 1 year ago

I'm wondering the same. 😮‍💨 The internet suggests both are similar. But yeah doesn't work for me.

So I extracted cert.pem and key.pem file, but from [.pfx file and password]. Then generated the keyStore.p12 from them and used it to sign the pdf. The program runs and exports the pdf but the error above. Please let me know if you or anyone tried this. Thanks!

superafroman commented 1 year ago

pfx and p12 are identical, you should be able to just change the extension. The problem here could be the password on the the private key. Did you remove that when creating your new p12 file?