2

I want to sign the PDF using client certificate. It only work when I got the file is stored in my PC. Since I want to sign my PDF by using the certificate stored inside a USB token, what should I do to achieve that.

I tried to search from the internet, but all I got are mostly using JAVA. Is there anyway to achieve the same goal using PHP? If not, can anyone provide an alternative way to sign my PDF.

Chen
  • 23
  • 1
  • 3
  • 1
    Are you talking about a PHP application that's running on a web server, and the USB token being attached to your client machine? Then forget it; it won't work. – cweiske Jun 07 '11 at 07:02
  • Yes, That is exactly what I mean. Thanks for your answer. This question bother me for a long time. I think I should find the possibility to use the soft cert instead of USB token. – Chen Jun 07 '11 at 07:17
  • For PHP, Java component may be used through JavaBridge running on Tomcat through Apache proxy to digitally sign PDF from Browser USB token and PHP on server side. Please refer to my answer in [this stackoverflow post](https://stackoverflow.com/questions/33216843/sign-pdf-with-plain-javascript) to check JavaScript – Bharat Vasant May 24 '19 at 11:35

2 Answers2

0

Are you talking about a PHP application that's running on a web server, and the USB token being attached to your client machine? Then forget it; it won't work because you cannot access the client's USB port from your web server via the client's browser without further plugins.

The java apps you're talking about are running in the client's browser and thus may have access to the usb port.

cweiske
  • 30,033
  • 14
  • 133
  • 194
0

The task is tricky but doable. You need to create a client-side module, then calculate the hash of the document on the server, send it along with the client module to the web browser (by including it into the web page) and have the client-side module sign the hash. Then send the hash back to the server.

Our SecureBlackbox product does this, but it's not currently available for PHP on the server side (we plan to release library edition with PHP binding somewhere next year).

Eugene Mayevski 'Callback
  • 45,135
  • 8
  • 71
  • 121