I have a java web applet which tries to connect to a hardware token through PKCS#11 and sign a String. When the web page is loaded the sign applet is loaded either. When a dialog comes up in the web form, the user should insert the hardware token's password and after clicking the sign button, the web form call applet's sign method and sign the sending String via the certificate on the token.
Note that all these steps are executing on the dialog without any sending request to the server, so the JMeter can not sense what is happening until the signed text is sending through a request to the server to save in DB.
(The signed String is different each time and it's based on the different ID which is existed on the field of the web form)
The problem is how can I call the applet's sign method with JMeter because the signed String is based on the ID, It would be different in Load Test either. So The JMeter should not send a static signed String in each load and should sign the different String for every thread.
I tried to copy applet's jar file in the lib folder of JMeter and call Sign method via BSF Sampler but I get the PKCS#11 Exception in the line which I used doPrivilaged
in applet's code.
Is there any help?
I found the solution,
Because PKCS#11 is in package sun.security.pkcs11.SunPKCS11
we should use JDK1.7.
The problem was JMeter was not set to use the JDK7. So I edited JMeter.bat file and change
set JM_LAUNCH=java.exe
with
set JM_LAUNCH="C:\Java\jdk1.7.0_03\bin\java.exe"
Hurraaaay. The problem solved :)