Search code examples
javasslcertificatedigital-signaturekeystore

How to Digitally sign a pdf document in the server using USB token in the client's system?


I need to digitally sign the PDF document in our server using digital certificate in the usb token. How this can be achieved? Is there any library/api for this? I tried to access the certificates in the browser as suggested in this link

        java.security.cert.X509Certificate certChain [] = (java.security.cert.X509Certificate [])request.getAttribute ("javax.net.ssl.peer_certificates"); 

But it is not giving any result. I'm using java. I tried accessing key-store,but it is returning the servers certificates instead of client's certificates. How can i access the client's certificates?


Solution

  • The link is for SSL authentication, not digital signature. You need a local java application to access USB token and a PDF library like itext or pdfbox.

    Itis not possible from browser (except using applets with IE / firefox and old versions of JRE plugin. I do not recommend it). See this and some alternatives here