vellezz.info

REST-owy POST z autoryzacją klienta certyfikatem w keystore.jks

Jun
08

Konwertujemy JKS na format PKCS12

keytool -importkeystore -srckeystore keystore.jks -destkeystore cert_and_key.p12 -deststoretype PKCS12

eksport certyfikatu:

openssl pkcs12 -in cert_and_key.p12 -nokeys -out cert.pem

eksport klucza:

openssl pkcs12 -in mykeystore.p12 -nodes -nocerts -out key.pem

import requests
import json
url="https://..."
params={}
response = requests.post(url, data=json.dumps(params), headers={"Content-Type": "application/json"}, verify=False, cert=('cert.pem', 'key.pem'))
print response.status_code

 

 

Leave a Reply