# SSL certificate seems not being sent to server (web services)

**URL:** <https://community.gatling.io/t/ssl-certificate-seems-not-being-sent-to-server-web-services/3269>\
**Category:** Gatling (Open-Source)\
**Created:** [September 14, 2016, 10:21am UTC](https://community.gatling.io/t/ssl-certificate-seems-not-being-sent-to-server-web-services/3269 "2016-09-14T10:21:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Maurizio\_Lattuada](https://avatars.discourse-cdn.com/v4/letter/m/e47774/32.png) [@Maurizio\_Lattuada](https://community.gatling.io/u/Maurizio_Lattuada)\
**Post date:** [September 14, 2016, 10:21am UTC](https://community.gatling.io/t/ssl-certificate-seems-not-being-sent-to-server-web-services/3269/1 "2016-09-14T10:21:12Z")

</div>

Hi folks,  
I’m using gatling 2.2.2 to do a load test on a webservice interface.  
The access to this interface is allowed only having a certificate.

I already have a truststore and a keystore. I verified both of them with the “keytool” application and

- the file exists
- the password is ok
- they contains the right stuff (private key, trusted CA…)  
Basically, I’ve the same problem as asked here:

[https://groups.google.com/d/msg/gatling/f8zdT-JP7qs/zxJ3zoI4AQAJ](https://groups.google.com/d/msg/gatling/f8zdT-JP7qs/zxJ3zoI4AQAJ)

This is my scala file I’m using.  
Note: some parts were removed, private stuff, but believe me, I’m using absolute paths to be super sure to find the related trust and keystore files (verified with the “keytool” application of the JDK).

`

package none

import scala.concurrent.duration.\_

import io.gatling.core.Predef.\_  
import io.gatling.http.Predef.\_  
import io.gatling.jdbc.Predef.\_

class TranferSimulation extends Simulation {

System.setProperty(“jsse.enableSNIExtension”, “false”)  
//  
// [http://gatling.io/docs/2.2.2/http/http\_ssl.html](http://gatling.io/docs/2.2.2/http/http_ssl.html)  
System.setProperty(“gatling.http.ssl.trustStore.file”, “SeleniumKeystore”)  
System.setProperty(“gatling.http.ssl.trustStore.password”, “selenium”)  
System.setProperty(“gatling.http.ssl.keyStore.file”, “my\_keystore.p12”)  
System.setProperty(“gatling.http.ssl.keyStore.password”, “password”)

println(“Environment variables”)  
println(" gatling.http.ssl.trustStore.file=" + System.getProperty(“gatling.http.ssl.trustStore.file”))  
println(" gatling.http.ssl.trustStore.password=" + System.getProperty(“gatling.http.ssl.trustStore.password”))  
println(" gatling.http.ssl.trustStore.type=" + System.getProperty(“gatling.http.ssl.trustStore.type”))  
println(" gatling.http.ssl.keyStore.file=" + System.getProperty(“gatling.http.ssl.keyStore.file”))  
println(" gatling.http.ssl.keyStore.password=" + System.getProperty(“gatling.http.ssl.keyStore.password”))  
println(" gatling.http.ssl.keyStore.type=" + System.getProperty(“gatling.http.ssl.keyStore.type”))  
println(" jsse.enableSNIExtension=" + System.getProperty(“jsse.enableSNIExtension”))

val httpProtocol = http  
.baseURL(“[https://address:4443](https://address:4443)”)  
.inferHtmlResources()  
.acceptEncodingHeader(“gzip,deflate”)  
.connectionHeader(“close”)  
.contentTypeHeader(“application/soap+xml;charset=UTF-8”)  
.userAgentHeader(“Apache-HttpClient/4.1.1 (java 1.5)”)

val uri1 = “[https://address:4443/web-module](https://address:4443/web-module)”

val feeder\_Certificates = Array(  
Map(  
“gatling.http.ssl.trustStore.file” → System.getProperty(“gatling.http.ssl.trustStore.file”),  
“gatling.http.ssl.trustStore.password” → System.getProperty(“gatling.http.ssl.trustStore.password”),  
“gatling.http.ssl.keyStore.file” → System.getProperty(“gatling.http.ssl.keyStore.file”),  
“gatling.http.ssl.keyStore.password” → System.getProperty(“gatling.http.ssl.keyStore.password”)))

val scn = scenario(“RecordedSimulation”)  
.feed(feeder\_Certificates)  
.exec(http(“request\_0”)  
.post("/web-module/web10")  
.body(RawFileBody(“content.txt”))  
.check(status.is(200)))

setUp(scn.inject(atOnceUsers(1))).protocols(httpProtocol)  
}

`

Here the Gatling output:

`

Environment variables  
gatling.http.ssl.trustStore.file=SeleniumKeystore  
gatling.http.ssl.trustStore.password=selenium  
gatling.http.ssl.trustStore.type=null  
gatling.http.ssl.keyStore.file=my\_keystore.p12  
gatling.http.ssl.keyStore.password=password  
gatling.http.ssl.keyStore.type=null  
jsse.enableSNIExtension=false  
12:08:01.072 [INFO] i.g.h.a.HttpEngine - Start warm up  
12:08:01.459 [INFO] i.g.h.a.HttpEngine - Warm up done  
Simulation none.TranferSimulation started…  
12:08:01.697 [WARN] i.g.h.a.ResponseProcessor - Request ‘request\_0’ failed: status.find.is(200), but actually found 403  
12:08:01.718 [DEBUG] i.g.h.a.ResponseProcessor -

---

<div class="post-metadata">

**Author:** ![Maurizio\_Lattuada](https://avatars.discourse-cdn.com/v4/letter/m/e47774/32.png) [@Maurizio\_Lattuada](https://community.gatling.io/u/Maurizio_Lattuada)\
**Post date:** [September 16, 2016, 9:48am UTC](https://community.gatling.io/t/ssl-certificate-seems-not-being-sent-to-server-web-services/3269/2 "2016-09-16T09:48:09Z")

</div>

Well, by using “disableClientSharing” everything worked fine.  
For completeness:

`

val httpProtocol = http  
.disableClientSharing  
.baseURL(“[https://addreess:4443](https://addreess:4443)”)  
.inferHtmlResources()  
.acceptEncodingHeader(“gzip,deflate”)  
.connectionHeader(“close”)  
.contentTypeHeader(“application/soap+xml;charset=UTF-8”)  
.userAgentHeader(“Apache-HttpClient/4.1.1 (java 1.5)”)

`

---

<div class="post-metadata">

**Author:** ![slandelle](https://dub1.discourse-cdn.com/flex013/user_avatar/community.gatling.io/slandelle/32/4_2.png) [@slandelle](https://community.gatling.io/u/slandelle)\
**Post date:** [September 16, 2016, 10:57am UTC](https://community.gatling.io/t/ssl-certificate-seems-not-being-sent-to-server-web-services/3269/3 "2016-09-16T10:57:16Z")

</div>

You cannot set System props in the simulation to override Gatling conf file.  
It’s too late, configuration has already been loaded (which is pretty obvious as you can configure in there the location of the simulations).

---

<div class="post-metadata">

**Author:** ![Maurizio\_Lattuada](https://avatars.discourse-cdn.com/v4/letter/m/e47774/32.png) [@Maurizio\_Lattuada](https://community.gatling.io/u/Maurizio_Lattuada)\
**Post date:** [September 16, 2016, 1:15pm UTC](https://community.gatling.io/t/ssl-certificate-seems-not-being-sent-to-server-web-services/3269/4 "2016-09-16T13:15:37Z")

</div>

Ok, clear and it makes perfectly sense.

I never edited the gatling.conf file, in fact there I’ve:

`http {`  
#fetchedCssCacheMaxCapacity = 200 # Cache size for CSS parsed content, set to 0 to disable  
#fetchedHtmlCacheMaxCapacity = 200 # Cache size for HTML parsed content, set to 0 to disable  
#perUserCacheMaxCapacity = 200 # Per virtual user cache size, set to 0 to disable  
#warmUpUrl = “[http://gatling.io](http://gatling.io)” # The URL to use to warm-up the HTTP stack (blank means disabled)  
#enableGA = true # Very light Google Analytics, please support  
ssl {  
keyStore {  
#type = “” # Type of SSLContext’s KeyManagers store  
#file = “” # Location of SSLContext’s KeyManagers store  
#password = “” # Password for SSLContext’s KeyManagers store  
#algorithm = “” # Algorithm used SSLContext’s KeyManagers store  
}  
trustStore {  
#type = “” # Type of SSLContext’s TrustManagers store  
#file = “” # Location of SSLContext’s TrustManagers store  
#password = “” # Password for SSLContext’s TrustManagers store  
#algorithm = “” # Algorithm used by SSLContext’s TrustManagers store  
}  
}  
…

Question: does it means that, even the properties being empty in the conf file, I cannot override them in my simulation file?

Thanks for your feedback.
