How to Use Windows Certificate Store in JMeter

Bruno Borges
Microsoft Azure
Published in
2 min readFeb 24, 2020

Authored by Chris Witte, from Microsoft Testing Services.

Authentication is almost always the most difficult part of scripting, for this application there was an API gateway (Layer7). In the process of migrating a Visual Studio Load Test to a JMeter Test Plan, we ran into issues providing a Client Certificate for authenticating with the API Gateway.

The flow is: Client sends a request with the certificate, a SAML token is returned, Client sends credentials along with the SAML token, and receives an L7 Session ID. After retrieving that L7 Session ID, the user can make requests to the API. JMeter is good at maintaining those session cookies, however providing the initial client certificate was an issue.

In JMeter you can specify a certificate store, so if you have a pk12 cert, this flow will not be an issue. In this case the cert was in the Windows personal cert store, and the private key was marked as not exportable. Creating a Java cert store was out of the question.

So, how do we get JMeter to load and use the Windows certificate store? It’s quite simple, however there were no resources online that I could find to show this solution. We are providing it here to hopefully save everyone else time.

It isn't that hard

To get the Windows Certificate Store available in JMeter, launch it with this command. The key here is keyStore=NONE and keyStoreType=Windows-MY.

Then in JMeter you need to specify which cert to use:

  1. Add a Keystore Configuration Element

2. Then add a variable that will store the alias to the keystore configuration

3. Then add the variable to the test. You can use a csv, or Redis data source. In our case we are using User Defined Variables. My cert’s alias is “chriswitte”

Now when you run your scripts it will add the client cert to your requests as requested.

--

--

Bruno Borges
Microsoft Azure

Brazilian, Product and Program Manager for Java at Microsoft. Promoting great developer technologies to the world. Previously at Oracle.