1

I have been trying to sign a pdf using USB token in angular (front end). I have tried below link for getting certificate from token. link.

But while signing a pdf using hex code of certificate from token (got it by above reference link) it is showing error: No private key. (currently I am signing in back end -.NET C#) and also tried in angular using this link

This reference is working fine for local certificates, but it is showing error while checking with USB token.

enter image description here

Suggestions are welcome.

mkl
  • 90,588
  • 15
  • 125
  • 265
Mounika
  • 23
  • 4
  • The first link you mentioned also points to further link which has complete C# project for download. The signing from USB Token can't happen on server side since the hash to be signed goes in USB token and sign comes out (in layman's terms!) Thus you will have to use mechanism to sign it on browser side. Signer.Digital Extension mehtioned in the link provides that mechanism. Front end on browser side can be anything! – Bharat Vasant Jan 21 '21 at 09:27
  • Even on server side you may use any pdf component. Concept remains the same! – Bharat Vasant Jan 21 '21 at 09:35
  • @BharatVasant Sorry for the inconvenience , i have wrongly mentioned the 1st link. i have edited now. – Mounika Jan 21 '21 at 09:59
  • the problem from first link is that base64/hex code of the certificate from token is not containing the private key – Mounika Jan 21 '21 at 10:05
  • @BharatVasant is that first link reference code [link] (https://stackoverflow.com/a/63173083/9659885) free or licensed? – Mounika Jan 21 '21 at 10:36
  • The Browser Extension for Chrome, Edge Chromium, and Firefox is Free. We charge for libraries on server side, but you may write your own server side code using your pdf component. The main idea is to get hash signed from browser which is being done by Free Signer.Digital Browser Extension. – Bharat Vasant Jan 21 '21 at 11:22
  • 1
    @Mounika *"the problem from first link is that base64/hex code of the certificate from token is not containing the private key"* - if you could extract the private key from the token, there would be no need for a token to start with. And copying the private key of one's certificate to some server essentially means giving up that certificate identity. – mkl Jan 21 '21 at 17:00
  • @mkl without private key how can i add signature to pdf .is there any way to do this?. while adding signature to pdf it is asking private key .please give me suggestion on this. – Mounika Jan 22 '21 at 04:59
  • @mkl I have attached the screenshot of error. In that what may be the problem ( i am using 2nd link for signing ). – Mounika Jan 22 '21 at 05:11
  • *"( i am using 2nd link for signing )"* - The second link only works for key pairs in a PKCS#12 file. It is in particular not useful for key pairs on smart cards, usb tokens, or HSMs. The first link (both with the current and the original URL) appear to claim to work for smart cards etc, too, so that's where you should probably look. – mkl Jan 22 '21 at 15:29

0 Answers0