0
votes

I have a curl command curl --header "IDS-SESSION-ID:000000000000" -k --key ./file.key.pem --cert ./file.crt.pem -X POST -v https://localhost:9086/api/v11.0/search

How can i pass certificate and key file in rest assured .

I have sample code below which work forother parameter in curl command

 RESTBase restClient = new RESTBase(URL + "/search");
restClient.skipSSLCertificateValidation();
restClient.setHeader("IDS-SESSION-ID", sessionId);
1

1 Answers

0
votes

First of all import your certificate to Java keystore

$ keytool -importcert -alias "some-ca" -file SomeBusinessCA-1.crt -keystore truststore_java.jks -storepass test1234

Then use following code:

given().config(newConfig().sslConfig(new SSLConfig("/truststore_java.jks", "test1234"))