pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Chojecki <i...@rayman2200.de>
Subject Re: Digitally sign PDF file using USB token sample required reg.
Date Fri, 17 Apr 2015 11:15:00 GMT
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 <subhash.gh@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


Mime
View raw message