JMeter can’t actually do SSL, it just pretends to be a client and needs you to provide the keys.

Let’s see JMeter make a secure connection.

# First, let's create a self-signed certificate for our test server.
# This is for demonstration; in production, you'd use a CA-signed cert.
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout server.key -out server.crt \
  -subj "/C=US/ST=State/L=City/O=Organization/CN=localhost"

# Now, let's create a keystore containing this certificate.
# This keystore will be used by JMeter to present its "identity" when connecting to a server that requires client authentication.
# For simple HTTPS testing where JMeter *is* the client and the server *doesn't* require client auth, this step is often skipped.
openssl pkcs12 -export -in server.crt -inkey server.key -out server.p12 -name mytestcert

# We also need a truststore for JMeter to trust the server's certificate.
# For a self-signed cert, we'll add it to the truststore.
keytool -import -alias mytestcert -file server.crt -keystore truststore.jks -storepass changeit -noprompt

Now, imagine you have a web server running on localhost:8443 with SSL enabled and configured to use server.crt and server.key. JMeter needs to be told how to connect to this secure endpoint.

Here’s a JMeter Test Plan snippet demonstrating the configuration:

  • Thread Group: Standard setup for your load test.
  • HTTP Request Sampler:
    • Protocol: https
    • Server Name or IP Address: localhost
    • Port Number: 8443
    • Method: GET (or your desired method)
    • Path: / (or your desired path)
  • HTTP Request Defaults (Optional but Recommended): Configure protocol, server, and port here to avoid repetition.
  • SSL Manager (Crucial):
    • Add an SSL Manager to your test plan (right-click on Test Plan -> Add -> Config Element -> SSLManager).
    • Keystore Type: PKCS12
    • Keystore File: server.p12 (the file you created earlier)
    • Keystore Password: changeit (or whatever you set)
    • Truststore Type: JKS
    • Truststore File: truststore.jks (the file you created earlier)
    • Truststore Password: changeit

When JMeter runs this, it will:

  1. Establish a TCP connection to localhost:8443.
  2. Initiate the TLS/SSL handshake.
  3. The SSL Manager tells JMeter to use server.p12 for its keystore and truststore.jks for its truststore.
  4. If the server requires client authentication, JMeter will present the certificate from server.p12.
  5. JMeter will validate the server’s certificate against the trusted certificates in truststore.jks. Since we explicitly added our self-signed server.crt to the truststore, the handshake will succeed.
  6. The HTTP request is then sent over the encrypted channel.

The core problem JMeter solves here is emulating a client’s SSL behavior. It doesn’t perform SSL encryption itself; it uses Java’s underlying security libraries. The SSL Manager is the bridge, telling those libraries where to find the necessary cryptographic material (keys and certificates) to complete the handshake and secure the communication.

The most surprising thing is how often people try to configure server.crt directly into the "Certificate File" field of an HTTP Request sampler. That field is for client certificates when the server explicitly asks for one, not for trusting the server’s identity. The SSL Manager is where the trust happens.

Once you’ve got SSL working, the next hurdle is dealing with certificate revocation lists or online certificate status protocol checks, which can add latency and complexity.

Want structured learning?

Take the full Jmeter course →