You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by GH Subhash <su...@nic.in> on 2015/04/17 11:45:53 UTC

Digitally sign PDF file using USB token sample required reg.

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

Re: Digitally sign PDF file using USB token sample required reg.

Posted by Thomas Chojecki <in...@rayman2200.de>.
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 <su...@nic.in>:

> 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: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org