Skip to content

JSignPdf in a batch mode gets stuck after signature creation and removing PKCS11 security provider #184

Description

@votocek

At first, thank you for a great SW.

  • Using JsignPdf 2.2.2 on Windows 10 x86-64.
  • Using CMD script to invoke JSignPdf in a batch mode.
  • When using PKCS12 keystore, it is working fine.
  • When using a hardware keystore (eObcanka used in the Czech Republic) with PKCS11 or JSIGNPKCS11 keystoretype, it does signing part well but then it gets stuck - it doesn't exit and return the prompt to the shell.
c:\App\GP>"c:\App\GP\Programy\zulu21.34.19-ca-jre21.0.3\bin\java" --add-exports=jdk.crypto.cryptoki/sun.security.pkcs11=ALL-UNNAMED --add-opens=java.base/sun.security.util=ALL-UNNAMED --add-exports=jdk.crypto.cryptoki/sun.security.pkcs11.wrapper=ALL-UNNAMED --add-exports=java.base/sun.security.action=ALL-UNNAMED --add-exports=java.base/sun.security.rsa=ALL-UNNAMED --add-opens=java.base/java.security=ALL-UNNAMED -Duser.language=en "-Djsignpdf.home=c:\App\GP\Programy\jsignpdf-2.2.2" -jar "c:\App\GP\Programy\jsignpdf-2.2.2/JSignPdf.jar" -kst PKCS11 -ksp 123456  "Test_pro_podpis.pdf"
FINE Relaxing SSL security.
FINE Registering SunPKCS11 provider from configuration in conf/pkcs11.cfg
FINE PKCS11 provider registered with name SunPKCS11-eObcanka
FINE PKCS11 provider registered with name JSignPKCS11-eObcanka
INFO Checking input and output PDF paths.
INFO Getting key alias
INFO Used key alias: iSignum 20240604-210002
INFO Loading private key
INFO Getting certificate chain
INFO Opening input PDF file: Test_pro_podpis.pdf
INFO Creating output PDF file: ./Test_pro_podpis_signed.pdf
INFO Creating signature
INFO Setting certification level
INFO Processing (it may take a while) ...
FINE KeyStore type PKCS11 is supported by the provider SunPKCS11-eObcanka
INFO Closing result PDF stream
INFO Finished: Signature succesfully created.
FINE Removing security provider with name SunPKCS11-eObcanka
FINE Removing security provider with name JSignPKCS11-eObcanka
<stuck here without returning prompt to the CMD script>  

Sometime it helps to press Ctrl+C to interrupt it but most of the time I need to close the whole window with Command Prompt.

  • I tried Zulu JRE 11 and 21.
  • I tried JSignPdf for Windows with bundled JRE and running JSignPdfC.exe wrapper. Result is the same. It works but then gets stuck.
  • If I use GUI version of JSignPdf then I don't notice any problems.

Any clue how to debug what is going wrong in a batch mode?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions