Hi,
I have never used USB token for signing, but other stuff like virtual keystores and smartcards. I got already a working Keystore implementation to access the private key from the device.

So for signing you will need to have a java.security.KeyStore that wraps the token and provide the certificate, private key and aliases from it. Also you will need to implement a java.security.Provider that can handle your keystore and the private key.

After all, you need to tell BouncyCastle that he might use your provider for signing operations on the key.

Look at the code here

https://github.com/Rayman2200/pdfbox-crypto/blob/1.8/src/main/java/org/apache/pdfbox/crypto/bc/BC14x_SignatureInterface.java

In the line 78 you need to use your provider name as "keyCryptoProvider"

Don't forget to register your provider with Security.addProvider() first or pass a Provider instance there.


If you does not meet this requirements with a already existing keystore implementation, you would need to google how you write your own provider [1]. This would be the harder part which is also out of scope in this mailing list.

[1] http://docs.oracle.com/javase/7/docs/technotes/guides/security/crypto/HowToImplAProvider.html

Best regards
Thomas


Zitat von GH Subhash <[email protected]>:

Hi!

Can anybody help me out by providing sample code for digitally signing PDF file using USB token.

Thank You and regards
जी. एच. सुभाष / G. H. Subhash




---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to