0

I have a requirement to make third party rest api call over https. I am wanting to use feign client inside spring Boot application. I have an idea about feign client and how to use it to make api calls. But I am not sure how to pass the certificate file and secret key. Below is sample python code extract that I wanted to achieve using feign client. Can some help me to incorporate the code marked as **.

certificate_file = 'example.com.pem'
certificate_secret= 'exampleserver.key'

**context = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
context.load_cert_chain(certificate_file, certificate_secret)
conn = http.client.HTTPSConnection("hostname", context=context)**
payload = "{<JSON payload>}"

headers = {
    'Content-Type': "application/json",
    }

conn.request("POST", "api/example/setInfo", payload, headers)
Sarav
  • 245
  • 3
  • 12

1 Answers1

0

Combine private key and public key into one pem file. Use openssl to convert the pem into pkcs12 file format. Use the pkcs12 file and the password used during pkcs12 creation to create keystore and truststore in the code. Command to create pkcs12 file

cat exampleserver.key > test.pem
cat example.com.pem >> test.pem

openssl pkcs12 -export -in test.pem -out test.pkcs12
Sarav
  • 245
  • 3
  • 12