Hi Josef,
Thank you for quick response.
I have installed Java 8.3 x64 in my 64 bit Windows 7 system.
I am executing the below command:
java -jar JSignPdf.jar D:\TestSign.pdf -kst PKCS#11 -ki 1 -pg 1 -V
Result:
DEBUG Relaxing SSL security.
DEBUG Registering SunPKCS11 provider from configuration in conf/pkcs11.cfg
Unable to register SunPKCS11 security provider.
I am not getting "SunPKCS11 provider" for Windows 64. Could you please provide any source to download the same?
Thank you,
Warm Regards,
Aliyas Yoyakey
Hi Josef,
My conf.properties file is in the path:
D:\Apps\JSignPdf\conf\conf.properties
-------------------File content---------------------
certificate.checkKeyUsage=false
pkcs11config.path=conf/pkcs11.cfg
----------------------------------------------------
My pkcs11.cfg file is in the path:
D:\Apps\JSignPdf\conf\pkcs11.cfg
-------------------File content---------------------
#ATTRS
name=JSignPdf
name=JSignPdf
library=C:\\WINDOWS\\system32\\eMudhraP11_ND_v34.dll
----------------------------------------------------
Note: I am using eMudhra USB eToken
My Java security file is in the path:
C:\Program Files\Java\jre1.8.0_31\lib\security\java.security
-------------------File content---------------------
# List of providers and their preference orders:
security.provider.1=sun.security.provider.Sun
security.provider.2=sun.security.rsa.SunRsaSign
security.provider.3=sun.security.ec.SunEC
security.provider.4=com.sun.net.ssl.internal.ssl.Provider
security.provider.5=com.sun.crypto.provider.SunJCE
security.provider.6=sun.security.jgss.SunProvider
security.provider.7=com.sun.security.sasl.Provider
security.provider.8=org.jcp.xml.dsig.internal.dom.XMLDSigRI
security.provider.9=sun.security.smartcardio.SunPCSC
security.provider.10=sun.security.mscapi.SunMSCAPI
----------------------------------------------------
My command line is:
D:\Apps\JSignPdf>java -jar JSignPdf.jar D:\Test.pdf -kst PKCS#11 -ki 1 -pg 1 -V
While executing it from command line, I am getting following error
Exception in thread "main" java.lang.ExceptionInInitializerError
at net.sf.jsignpdf.ssl.DynamicX509TrustManager.<init>(DynamicX509TrustManager.java:71)
Kindly help me to resolve the issue. Am I not configuring Java libs proporly?, please guide me.
Warm Regards,
Aliyas Yoyakey
Hi Josef,
java -Djava.security.debug=sunpkcs11,pkcs11 -jar JsignPDF.jar
It prompted the GUI and shown the certificate alias name from the keystore. Surprisigly, it was listed PKCS11 in the keystore.
but it says
INFO Getting key alias
INFO Used key alias: <shown name>
INFO Loading private key
INFO Getting certificate chain
INFO No private key was found. Check the keystore settings (keystore type, filepath, password, key alias).
INFO Finished: Creating of signature failed.
Note: Certificate Chain is already present.
Using WINDOWS-MY, I am able to sign the document. So private key is also present.
Even though PKCS11 was listed in the keystore, how come it could not find private key?
Since I am able to sign PDF with WINDOWS-MY keystore, I would like to use same method. The only problem is that for bulk PDF signing, system should remember the eToken password.
This is already done in your GUI (check box for remember password). Could you please let me know how did you do that? So that I can incorporate the same method in my GUI (to retain the first time inputted password in the memory variable and use for next PDF signing)
Regards,
Aliyas Yoyakey