PKCS#11 and smart card signing

1,700 views
Skip to first unread message

Maurizio Barbagin

unread,
Jan 5, 2013, 6:19:12 AM1/5/13
to jsig...@googlegroups.com
I've downloaded latest binary version JSignPdf 1.4.3 and configured to use a PKCS##11 smart card reader (SCR3310v2 with Actalis Siemens Smart Card) with:
 
conf.properties:
pkcs11config.path=conf/pkcs11.cfg
 
pkcs11.cfg
library=C:\\WINDOWS\\system32\\si_pkcs11.dll
 
Using the app, I've configured the following information:
Keystore type = PKCS11
Keystore file   = nothing
Keystore password = <smart card PIN>
 
after pressing "Loads keys" it correctly loads the "Key alias" present but when I try to sign the pdf it throws the following exception:
 
INFO  Getting keystore type instance: PKCS11
INFO  Getting key alias
INFO  Starting JSignPdf
INFO  Checking input and output PDF paths.
INFO  Used key alias: Firma Digitale Qualificata 3-2012
INFO  Loading private key
INFO  Getting certificate chain
INFO  Opening input PDF file: C:\Programmi\jsignpdf\docs\JSignPdf.pdf
INFO  Creating output PDF file: C:\Programmi\jsignpdf\docs\JSignPdf_signed2.pdf
INFO  Creating signature
INFO  Updating PDF version info 1.4 -> 1.7
INFO  Setting reason: Firma
INFO  Setting location: Padova
INFO  Setting contact: Contatto
INFO  Setting certification level
INFO  Configuring visible signature
INFO  Use only layers recommend by Acrobat 6: true
INFO  Setting background image scale
INFO  Setting Layer 2 text (description)
INFO  Setting Layer 4 text (status)
INFO  Setting Render mode
INFO  Creating visible signature
INFO  Processing (it may take a while) ...
INFO  Finished: Creating of signature failed.
Exception in thread "Thread-4" java.lang.NoSuchMethodError: org.bouncycastle.asn1.DERSequence.<init>(Lorg/bouncycastle/asn1/ASN1EncodableVector;)V
        at com.lowagie.text.pdf.PdfPKCS7.getAuthenticatedAttributeSet(Unknown Source)
        at com.lowagie.text.pdf.PdfPKCS7.getAuthenticatedAttributeBytes(Unknown Source)
        at net.sf.jsignpdf.SignerLogic.signFile(SignerLogic.java:344)
        at net.sf.jsignpdf.SignerLogic.run(SignerLogic.java:108)
        at java.lang.Thread.run(Unknown Source)
 
It seems that jsignpdf-itxt is using an incorrect Bouncy Castle version ?
I've tried to rebuild jsignpdf from source with NetBeans but without success.
 
The goal is to use jsignpdf within an application to digitally sign documents via the PIN from the command line.
 
Any help will be appreciated
 
Maurizio Barbagin

Josef Cacek

unread,
Jan 8, 2013, 1:14:06 AM1/8/13
to JSignPdf forum
Hello Maurizio,
the Bouncy Castle version included with the project should be OK.
Do you have some other BC libraries somewhere in the system (and a
system wide CLASSPATH configured)?
Do you use the JSignPdf from the installer and then the EXE launchers
(JSignPdf.exe and for console JSignPdfC.exe)?
Best regards,
-- Josef
> --
> You received this message because you are subscribed to the Google Groups
> "JSignPdf" group.
> To post to this group, send email to jsig...@googlegroups.com.
> Visit this group at http://groups.google.com/group/jsignpdf?hl=en-US.
>
>

Maurizio Barbagin

unread,
Jan 10, 2013, 8:42:47 AM1/10/13
to jsig...@googlegroups.com

Hello Josef,
    I forgot to try the installer version....
I was using the bynary zip files with JDK 1.6.0_38 installed and this is the problem!!
I used "java -jar JSignPdf.jar" with no global CLASSPATH environment.

With the installer version and the JRE 1.6.0_30 embedded everything works fine!

Thank you very much for your valuable support and many compliments for your great work
 
Reply all
Reply to author
Forward
0 new messages