0

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?

Hana Bzh
  • 2,212
  • 3
  • 18
  • 38

1 Answers1

0

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 :)

Hana Bzh
  • 2,212
  • 3
  • 18
  • 38
  • 1
    Good to know you solved your issue. The only thing I would recommend to change is to use JSR223 Sampler (and groovy language) instead of BSF and whatever you're using now in order to get better performance. See [Beanshell vs JSR223 vs Java JMeter Scripting: The Performance-Off You've Been Waiting For!](https://blazemeter.com/blog/beanshell-vs-jsr223-vs-java-jmeter-scripting-its-performance) article for more details – Dmitri T Jan 06 '16 at 08:03
  • @DmitriT oh, this is the second time you mention this. thanks. I put reading about JSR223 sampler in my plan. I believe you are an expert in this field and know it's an important thing to learn and use. Thanks again for your help – Hana Bzh Jan 06 '16 at 08:18