Problema para firmar por consola

268 views
Skip to first unread message

Dante Sicardi

unread,
Feb 20, 2017, 7:12:44 AM2/20/17
to JSignPdf
Buenas, les comento el problema que tengo. Para firmar por consola, utilizo el siguiente comando:

java -jar /home/jsignpdf-1.5.3/JSignPdf.jar --out-directory /home/firmador/temp -a -kst PKCS11 -ksp CLAVE123 archivo.pdf

El problema es cuando por ejemplo la clave tiene un guión adelante, el jsign interpreta que es un parámetro y tira error. Por ejemplo:

java -jar /home/jsignpdf-1.5.3/JSignPdf.jar --out-directory /home/firmador/temp -a -kst PKCS11 -ksp -aaa789 archivo.pdf

Hay alguna forma de escapar la clave?

Saludos.

Josef Cacek

unread,
Feb 21, 2017, 2:27:59 AM2/21/17
to JSignPdf forum
The dash should work. What error do you see?

I've tried following:

~/jsignpdf-1.6.1$ keytool -genkey -alias demo -keyalg RSA -keystore
/tmp/demo.keystore -dname "CN=demo" -storepass -mykeystore -keypass
-mykeystore
~/jsignpdf-1.6.1$ java -Duser.language=en -jar JSignPdf.jar -ksf
/tmp/demo.keystore -ksp -mykeystore ~/test.pdf
DEBUG Relaxing SSL security.
INFO Checking input and output PDF paths.
INFO Getting key alias
INFO Used key alias: demo
INFO Loading private key
INFO Getting certificate chain
INFO Opening input PDF file: /home/kwart/test.pdf
INFO Creating output PDF file: ./test_signed.pdf
INFO Creating signature
INFO Setting certification level
INFO Processing (it may take a while) ...
INFO Closing result PDF stream
INFO Finished: Signature succesfully created.

-- jc
> --
> You received this message because you are subscribed to the Google Groups
> "JSignPdf" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to jsignpdf+u...@googlegroups.com.
> To post to this group, send email to jsig...@googlegroups.com.
> Visit this group at https://groups.google.com/group/jsignpdf.
> For more options, visit https://groups.google.com/d/optout.

Dante Sicardi

unread,
Feb 21, 2017, 6:39:37 AM2/21/17
to JSignPdf
C:\Program Files\Java\jre1.8.0_77\bin>keytool -genkey -alias demo -keyalg RSA -k
eystore demo.keystore -dname "CN=demo" -storepass -aaa10420 -keypass -mykeystore


C:\Program Files\Java\jre1.8.0_77\bin>java -Duser.language=en -jar c:/JSignPDF/J
SignPDF.jar -ksf demo.keystore -ksp -aaa10420 c:/firmador/1.pdf
Unable to parse command line (Use -h for the help)
Missing argument for option: ksp

C:\Program Files\Java\jre1.8.0_77\bin>

El problema es cuando el primer carácter después del guión medio, es un parámetro del Jsign (por ej -a es un parámetro); entonces no funciona la clave. Si la clave fuese, por ejemplo: -www12345, ahí si funciona.
Reply all
Reply to author
Forward
0 new messages