admin管理员组文章数量:1122832
I have a webservice that requires a client certificate for authentication. I want to access this webservice using HTTPX (Python), but I don't see how to make this work with my p12 certificate store. It seems that HTTPX needs the certificate file, the privatekey file and the password. Is there no way to directly use the p12 file?
I would like to pass the filepath to the p12 file (or its binary content) plus the password to HTTPX
I have a webservice that requires a client certificate for authentication. I want to access this webservice using HTTPX (Python), but I don't see how to make this work with my p12 certificate store. It seems that HTTPX needs the certificate file, the privatekey file and the password. Is there no way to directly use the p12 file?
I would like to pass the filepath to the p12 file (or its binary content) plus the password to HTTPX
Share Improve this question asked Nov 22, 2024 at 17:42 Tom ArnTom Arn 12 Answers
Reset to default 0HTTPX does not directly support loading PKCS12 (.p12) files, but you can use the cryptography library to extract the necessary key and certificate from the PKCS12 file and then pass them to HTTPX
- Extract certificate and private keys from pkcs12 store
- Install
certifi
package - Add pem certificates to python's certificates
cat /home/lmc/projects/lmc-local.cert.pem >> /home/lmc/.local/lib/python3.11/site-packages/certifi/cacert.pem
From the docs
By default, HTTPX uses the CA bundle provided by Certifi.
本文标签: pythonHow to use a PCKS12 file with HTTPXStack Overflow
版权声明:本文标题:python - How to use a PCKS12 file with HTTPX? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736301831a1931314.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论