hwcrypto / hwcrypto.js

Browser JavaScript library for working with hardware tokens
https://hwcrypto.github.io
MIT License
157 stars 47 forks source link

certificate base64/hex code doesn't contain the private key error #64

Closed Mounika80244 closed 3 years ago

Mounika80244 commented 3 years ago

I got the certificate from the token as a hex code ,so i need to use this certificate to sign a pdf in back end (.net C#). but I got error private key is missing. I have a doubt that always certificate from the token does not has private key or I made mistake somewhere else . Additional information: I got the details of the certificate from its hex code , but while signing only its showing No private key error I am using hwcrypto.js for getting certificate from USB token.

Mounika80244 commented 3 years ago

@metsma @martinpaljak @andris9 @ahoa if any body knows please help me

martinpaljak commented 3 years ago

Certificates don't contain private keys but public keys, by design. Use the sign() method to sign.

Mounika80244 commented 3 years ago

@martinpaljak (Use the sign() method to sign.) I need to add signature to a pdf .here sign() method returns hex value of signature only.

jchapelle commented 3 years ago

Hey @Mounika80244,

Didi you succeed adding a signature to a pdf ? I have the same use case ...