简体   繁体   中英

HTTPS connection using PFX Certificate Thumbprint

I Need to connect into a server using a PFX certificate or PFX certificate thumbprint.

I've trying to find how to connect into my server using a PFX and there is nothing over internet can show me how to do it.

so far what I have is the usage of "requests" library (module), please see what i have so far:

 import requests
 requests.get("https://my.server.com/api/ping")

 output: 
 <Response [403]>

As far as I know, the 403 error code is due to server has rejected the connection, and I can understand that, it needs the certificate in order accept the connection.

PFX is also called PKCS#12, so please have a look at the pkcs12 library for requests.

https://pypi.org/project/requests-pkcs12/

It adds the necessary parts and pieces to use PFX files instead of PEM files for requests.

eg

from requests_pkcs12 import get

r = get('https://example.com/test', pkcs12_filename='clientcert.p12',  pkcs12_password='correcthorsebatterystaple')

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM