1

I test a Rest API with KarateDSL, which goes very well. But currently I'm trying to send request with authentication via client TLS certificates.

Curl looks like this:

curl -X POST https://<urlOfEndPoint> -d '{ "id":"First","status":"Active" }' --cert cert.crt:password --key cert.key --insecure

Is it some way, how to send this request from Karate? Or some workaround?

Thank you in advance

Vaclav Ruzek
  • 11
  • 1
  • 2
  • Just searched and saw this question since I ran into the same issue too. – Greg Sep 14 '21 at 11:14
  • My solution is to convert my key/cert file by using openssl using "openssl pkcs12 -export -in /path/to/your/cert.pem -inkey /path/to/your/key.pem -out /path/to/output/cert.p12 -password pass:${pwd}" and then feed your cert.p12 to the Karate config like Peter mentioned below. * configure ssl = { keyStore: 'file:/path/to/output/cert.p12', keyStorePassword: 'yourPwd', keyStoreType: 'pkcs12' }; Then it should be setup correctly. – Greg Sep 14 '21 at 11:20

1 Answers1

-1

Please refer the doc and examples: https://github.com/intuit/karate#x509-certificate-authentication

# enable X509 certificate authentication with PKCS12 file 'certstore.pfx' and password 'certpassword'
* configure ssl = { keyStore: 'classpath:certstore.pfx', keyStorePassword: 'certpassword', keyStoreType: 'pkcs12' };
Peter Thomas
  • 54,465
  • 21
  • 84
  • 248