Cert Human: SSL Certificates for Humans¶
Description¶
Somebody said something about over-engineering. So I obviously had to chime in.
No, but seriously, I was in the midst of rewriting another project of mine, and I wanted to incorporate a method to get an SSL certificate from a server, show the user the same kind of information as you’d see in a browser, prompt them for validity, then write it to disk for use in further requests using requests
to a server.
I was unable to find any great / easy ways that incorporated all of these concepts into one neat thing. So I made a thing.
Originally this was based off of the lovely over-engineered solution in get-ca-py by Josh Peak.
I wound up wanting a more offically supported way of patching urllib3 to have access to the certificate attributes in the raw attribute of a requests.Response
object. So I wrote Replacement Connect and Response subclasses for urllib3.HTTPSConnectionPool
, and a patcher, unpatcher, and context manager to enable/disable the new classes.
I also wanted some generalized utility functions to get the certificates, so I wrote some get certificate functions.
I then wanted an easier, more human way of accessing all of the information in the certificates. And that wound up turning into a whole thing. So CertStore and CertChainStore classes were born.
Python Versions Supported¶
I only focused on writing and testing for the latest versions of 2.7 and 3.7. It might work on other versions, have fun.
Installation¶
Install into your system wide site-packages:
$ pip install cert_human
Or install into your pipenv:
$ pipenv install cert_human
Get the Source Code¶
Cert Human is actively developed on GitHub, where the code is always available.
You can clone the public repository:
$ git clone git://github.com/lifehackjim/cert_human.git
Once you have a copy of the source, you can embed it in your own Python package, or install it into your site-packages easily:
$ cd cert_human
$ pip install .
Table of Contents¶
- 1. CLI
- 2. API
- 2.1. High level API Examples
- 2.2. Low level API Examples
- 2.3. API Reference