I am trying to do simple windows signing of pdf but this is the error i get:
C:\Program Files\JSignPdf>java -jar JSignPdf.jar -kst WINDOWS-MY barkod_proba.pd
f
Getting keystore type instance: WINDOWS-MY
Getting key alias
Loading private key
Getting certificate chain
Opening input PDF file: barkod_proba.pdf
Creating output PDF file: ./barkod_proba_signed.pdf
Creating signature
Setting certification level
Processing (it may take a while) ...
Problem occured
java.lang.NullPointerException
at com.lowagie.text.pdf.PdfPKCS7.<init>(Unknown Source)
at com.lowagie.text.pdf.PdfSigGenericPKCS.setSignInfo(Unknown Source)
at com.lowagie.text.pdf.PdfSignatureAppearance.preClose(Unknown Source)
at com.lowagie.text.pdf.PdfSignatureAppearance.preClose(Unknown Source)
at com.lowagie.text.pdf.PdfStamper.close(Unknown Source)
at net.sf.jsignpdf.SignerLogic.run(SignerLogic.java:168)
at net.sf.jsignpdf.Signer.signFiles(Signer.java:120)
at net.sf.jsignpdf.Signer.main(Signer.java:68)
Finished: Creating of signature failed.
I generated certificate from windows CA which i installed locally and tried to run sign application.
Any clues what could be the problem?
Could you try the behavior on version 0.9.5 (it's not a public release)?
- windows installer
http://jsignpdf.sourceforge.net/test-release/JSignPdf_setup_0.9.5_wjre.exe
- zip archive
http://jsignpdf.sourceforge.net/test-release/JSignPdf-0.9.5.zip
View and moderate all "bugs-change-requests Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Bugs & Change requests"
Still problem but with different message
When i used windows-my option:
Starting PDF Signer
Getting key alias
Used key alias: {0}
Loading private key
Getting certificate chain
Opening input PDF file: C:\Documents and Settings\dreic\My Documents\barkod_proba.pdf
Creating output PDF file: C:\Documents and Settings\dreic\My Documents\barkod_proba_sign.pdf
Creating signature
Setting reason: test
Setting location: Split, ITsistemi
Setting certification level
Processing (it may take a while) ...
Problem occured
java.lang.NullPointerException
at com.lowagie.text.pdf.PdfPKCS7.<init>(Unknown Source)
at net.sf.jsignpdf.SignerLogic.run(SignerLogic.java:175)
at java.lang.Thread.run(Unknown Source)
Finished: Creating of signature failed.
This is with JKS keystore:
Starting PDF Signer
Getting key alias
Used key alias: {0}
Loading private key
Problem occured
java.lang.NullPointerException
at sun.security.provider.JavaKeyStore$JKS.convertAlias(Unknown Source)
at sun.security.provider.JavaKeyStore.engineGetKey(Unknown Source)
at sun.security.provider.JavaKeyStore$JKS.engineGetKey(Unknown Source)
at java.security.KeyStore.getKey(Unknown Source)
at net.sf.jsignpdf.KeyStoreUtils.getPkInfo(KeyStoreUtils.java:236)
at net.sf.jsignpdf.SignerLogic.run(SignerLogic.java:60)
at java.lang.Thread.run(Unknown Source)
Finished: Creating of signature failed.
I think the button Load keys isn't working. If i select JKS and press load keys i don't see anything and there should be my allias since i created java keystore with allias when i was importing certificate.
OK, it seems, you have no "Private key" in your keystore (or Java couldn't for some reason read it). Isn't it possible, you have only certificates without private key in the keystore?
Do you see your certificates in "Internet Options->Content->Certificates->Personal"?
The normal output should look like (see the value "Used key alias"):
c:\Program Files\JSignPdf>java -Duser.language=en -jar JSignPdf.jar -kst WINDOWS-MY docs/JSignPdf.pdf
Getting key alias
Used key alias: signKey#1
Loading private key
Getting certificate chain
Opening input PDF file: docs/JSignPdf.pdf
Creating output PDF file: ./JSignPdf_signed.pdf
Creating signature
Setting certification level
Processing (it may take a while) ...
Closing result PDF stream
Finished: Signature succesfully created.
View and moderate all "bugs-change-requests Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Bugs & Change requests"
I have 2 personal certificate with private key which is stored on USB smart card. C So in order to sign documents (doc, emai, pfd) with thosw 2 certificates i get a popup windows which requries me to enter PIN to be able to sign document (in Word, Outlook or Adobe Acrobat).
The key i generated from my domain CA doesn't have private key.
And do you see your key aliases in the JSignPdf GUI?
View and moderate all "bugs-change-requests Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Bugs & Change requests"
Unfortunatley not
Last edit: Anonymous 2016-01-10
Then I suppose the problem comes from Java-Windows communication and the JSignPdf is only a victim of this bug/behavior/...
You were right. I installed everything od Windows 2003 (was XP previous) and it worked.
Btw i am interested are you considering in implementing batch signing ? For example "sign all(*) .pdf files in C:\xx directory and add _signed to name of the file in destination folder".
Batch signing should be enough powerfull already. Please consult possibilities of your shell (cmd /?, set /?, ...)
You can try e.g. following batch (run in "cmd /V:ON"):
set FILES=
for %%i in (c:\YourPath\*.pdf) do set FILES=!FILES! "%%i"
java -jar JSignPdf.jar -kst WINDOWS-MY %FILES%
Yes, with Linux is live easier :-)