Open votocek opened 5 months ago
I did several testing and I can confirm:
When this file is present and contains configuration for the Czech Republic identity card (second version issued from 07/2018):
# Sample file for registering PKCS#11 security provider in JSignPdf
# Feel free to edit it and then set path to the file in the conf.properties configuration file.
name=eObcanka
# Windows:
# This is a proxy DLL which should point you to a correct version of DLL based on your card version
#library=C:\Windows\System32\eopproxyp11.dll
# Let's use directly the correct DLL for second version of the card:
library=C:\Windows\System32\eop2v1czep11.dll
# Linux:
#library=/usr/lib/x86_64-linux-gnu/libeopproxyp11.so
#library=/usr/lib/x86_64-linux-gnu/libeop2v1czep11.so
then I am able to complete signing in a batch mode but JSignPDF program gets stuck after removing PKCS11 security provider. Please see the output in the previous post.
No difference when using “proxy DLL” (eopproxyp11.dll) or the correct DLL directly (eop2v1czep11.dll).
Any idea why JSignPDF is working in a different way in a batch mode and GUI mode in Windows?
Have you tried the windows distribution too? i.e. using the JSignPdfC.exe
wrapper
Ah, I see, you tried it. Wasn't reading fully the first message.
Let me add more information and correct my previous statement:
I think the problem is related to manipulation with PKCS11 library (C:\Windows\System32\eop2v1czep11.dll
) which is part of the SW for the Czech eObcanka (https://info.identitaobcana.cz/Download/). The author of this SW (MONET+ a.s.) claims that the application uses OpenSSL Toolkit.
If the issues is not in JSignPDF program and it is in the provided PKCS11 library, then there is no help, I am afraid. Thank you for any ideas what to try.
Could you try using jstack
to dump the stack trace (when it got stuck) and paste it here?
jstack -l <JavaProcessId>
Thank you for help. Unfortunately, I am not able to get the trace while the java process gets stuck – getting „access denied“ error regardless of running the jstack
command as a normal user (=the same user as JSignPDF) od local admin.
Let me demonstrate my testcase: First CMD window – run JSignPDF:
REM set JAVA_HOME=%~dp0..\zulu21.34.19-ca-jre21.0.3
REM Use JDK instead:
set JAVA_HOME=%~dp0..\zulu21.34.19-ca-jdk21.0.3
set JAVA_PRG=%JAVA_HOME%\bin\java
set JSIGN_HOME=%~dp0
REM Options copied from the Linux shell script version:
set JAVA_OPTS=--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
"%JAVA_PRG%" %JAVA_OPTS% -Duser.language=en -Djsignpdf.home=%JSIGN_HOME% -jar "%JSIGN_HOME%JSignPdf.jar"
JSignPDF starts in a GUI mode and it writes to CMD window as a console output:
FINE Relaxing SSL security.
FINE Registering SunPKCS11 provider from configuration in conf/pkcs11-windows.cfg
FINE PKCS11 provider registered with name SunPKCS11-eObcanka
FINE PKCS11 provider registered with name JSignPKCS11-eObcanka
In the second CMD window as a local admin:
REM Try to get jstack while JSignPDF is running:
c:\App\GP>c:\App\GP\Programy\zulu21.34.19-ca-jdk21.0.3\bin\jstack.exe -l 2832
OK. I got some output. jstack
is working.
Now I close the JSignPDF. Its window closes but java.exe
process with PID=2832 still exists.
It writes to the CMD window:
FINE Removing security provider with name SunPKCS11-eObcanka
FINE Removing security provider with name JSignPKCS11-eObcanka
Try to run jstack:
c:\App\GP>c:\App\GP\Programy\zulu21.34.19-ca-jdk21.0.3\bin\jstack.exe -l 2832
2832: Přístup byl odepřen
Access denied error.
Any clue? Did I something wrong?
At first, thank you for a great SW.
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
.Any clue how to debug what is going wrong in a batch mode?