0

In JMeter I want to use a client certificate without all the overhead of converting the certificate and do not forget to click on the SSL Manger Menu after JMeter restart.

I want the flexibility to use different certificates where ever needed.

The Java Solution here looks very promising. I tried to use a JSR223 PreProcessor with Groovy. This fails with the first line. It was unable to import a standard Java Class.

2017-11-08 16:02:39,139 ERROR o.a.j.m.JSR223PreProcessor: Problem in JSR223 script, JSR223 PreProcessor
javax.script.ScriptException: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
Script37.groovy: 1: unable to resolve class java.security.Keystore
 @ line 1, column 1.
   import java.security.Keystore;

What do I have to do to use standard Java classes?

The whole idea is based on a solution used in SoapUI.

import com.eviware.soapui.settings.SSLSettings
import com.eviware.soapui.model.settings.Settings
import com.eviware.soapui.SoapUI
Settings settings = SoapUI.getSettings()
settings.setString(SSLSettings.KEYSTORE, "../certificates/foo.p12")
settings.setString(SSLSettings.KEYSTORE_PASSWORD , "bar")
settings.reloadSettings()

Will something like this work in JMeter? Which client is used to send the HTTP samplers?

Nabor
  • 1,661
  • 3
  • 20
  • 45

1 Answers1

0

These are not "standard Java classes", it looks like something from SoapUI

You need to have these com.eviware.soapui.* classes under JMeter Classpath in order to make it work. Once you add the necessary .jars JMeter restart will be required to pick them up. However I doubt you will be able to use this com.eviware.soapui.model.settings.Settings class instance in JMeter test.

There is an easier way to configure JMeter to use client-side certificates: just add the next lines to system.properties file:

javax.net.ssl.keyStoreType=pkcs12    
javax.net.ssl.keyStore=../certificates/foo.p12
javax.net.ssl.keyStorePassword=bar

or pass them via -D command-line argument to JMeter startup script like:

jmeter -Djavax.net.ssl.keyStoreType=pkcs12 -Djavax.net.ssl.keyStore=../certificates/foo.p12 -Djavax.net.ssl.keyStorePassword=bar -n -t test.jmx -l result.jtl

See How to Set Your JMeter Load Test to Use Client Side Certificates article for more details on the approach.

Dmitri T
  • 159,985
  • 5
  • 83
  • 133
  • I have read my question once again. I don’t see how you get the impression that I wanted to use SoapUI classes. As you can clearly read I want to import java.security.Keystore and this is indeed a standard Java class. – Nabor Nov 08 '17 at 18:02