Easy PEM file parsing in Python.
It runs on Python 2.7, 3.4, and PyPy 2.0+, has no dependencies and does not attempt to interpret the certificate data in any way. pem is intended to ease the handling of PEM files in combination with PyOpenSSL and – by extension – Twisted.
It’s born from the need to load keys, certificates, trust chains, and DH parameters from various certificate deployments: some servers (like Apache) expect them to be a separate file while others (like nginx) expect them concatenated to the server certificate. To be able to cope with both scenarios in Python, pem was born:
>>> import pem >>> certs = pem.parse_file("chain.pem") >>> certs [<Certificate(PEM string with SHA-1 digest '...')>, <Certificate(PEM string with SHA-1 digest '...')>] >>> str(certs) '-----BEGIN CERTIFICATE-----\n...'
Additionally to the vanilla parsing code, pem also contains helpers for Twisted that save a lot of boilerplate code.
Python 3.3 and 2.6 aren’t supported anymore. They may work by chance but any effort to keep them working has ceased.
The last Python 2.6 release was on October 29, 2013 and isn’t supported by the CPython core team anymore. Major Python packages like Django and Twisted dropped Python 2.6 a while ago already.
Python 3.3 never had a significant user base and wasn’t part of any distribution’s LTS release.
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|File Name & Checksum SHA256 Checksum Help||Version||File Type||Upload Date|
|pem-16.1.0-py2.py3-none-any.whl (15.8 kB) Copy SHA256 Checksum SHA256||py2.py3||Wheel||Apr 8, 2016|
|pem-16.1.0.tar.gz (26.4 kB) Copy SHA256 Checksum SHA256||–||Source||Apr 9, 2016|