Open himanshusuri opened 7 years ago
I am able to solve this issue with the help of java libraries and grinder APIs. If you need I can post my solution here
I would like that if you can post it here
Hi Jens
IT has been a while since I wrote this code. I will try to recollect and write it here
SET KEYSTORE // -Dhttp.proxyHost=proxynlwp.europe.intranet -Dhttp.proxyPort=8080 keyStoreStream = new FileInputStream(new File(myKSURL.toURI())) keyStore = KeyStore.getInstance("JKS") keyStore.load(keyStoreStream, keystore_password.toCharArray())
HTTPPluginControl.getHTTPUtilities().basicAuthorizationHeader(accesstoken_key, accesstoken_value)
setSSLContext private HTTPConnection setSSLContext() { try { char[] myPassword = super.keystore_password.toCharArray() SSLContext mySSLContext = SSLContext.getInstance(super.ssl_protocol) KeyManagerFactory myKeyManagerFactory = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm()) myKeyManagerFactory.init(keyStore, myPassword) mySSLContext.init(myKeyManagerFactory.getKeyManagers(), null, null) HTTPConnection myHTTPSConnection = new HTTPConnection(super.protocol, super.hosts[ random.nextInt( super.hosts.length ) ], (int) Integer.parseInt(super.port))
myHTTPSConnection.setProxyServer("PROXYHOST", PROXYPORT) //optional
SSLSocketFactory mySSLSocketFactory = mySSLContext.getSocketFactory()
myHTTPSConnection.setSSLSocketFactory(mySSLSocketFactory)
return myHTTPSConnection
} catch (NoSuchAlgorithmException e) {
e.printStackTrace()
} catch (KeyManagementException e) {
e.printStackTrace()
} catch (KeyStoreException e) {
e.printStackTrace()
} catch (CertificateException e) {
e.printStackTrace()
}
}
Use the HTTPConnection to make a request public static HTTPConnection SSLHTTPConnection = setSSLContext() HTTPResponse myResponse =SSLHTTPConnection.Post(super.url_resource, myMessageBody,(NVPair[]) myHeaders.toArray())
Hey,
I am trying to write a client which sends requests to the server over SSL. The client needs to use the certificate(public) in its request. The certificate are stored in a keystore. The language I am using is groovy and JDK version is 1.8.
I have looked in your documentation and on internet and there is not many examples on how we can implement this client. Do you have any example for the same.
Thanks in advance for the help
Regards Himanshu