skip to navigation
skip to content

pem 17.1.0

Easy PEM file parsing in Python.

pem: Easy PEM file parsing

pem is an MIT-licensed Python module for parsing and splitting of PEM files, i.e. Base64 encoded DER keys and certificates.

It runs on Python 2.7, 3.4+, and PyPy, has no dependencies, and does not attempt to interpret the certificate data in any way. pem’s original intent was 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, others (like nginx) expect them concatenated to the server certificate and finally some (like HAProxy) expect key, certificate, and chain to be in one file. With pem, your Python application can cope with all of those scenarios:

>>> 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[0])
'-----BEGIN CERTIFICATE-----\n...'

Additionally to the vanilla parsing code, pem also contains helpers for Twisted that save a lot of boilerplate code.

pem’s documentation lives at Read the Docs, the code on GitHub.

Release Information

17.1.0 (2017-08-10)

Changes:

Full changelog.

Credits

pem is written and maintained by Hynek Schlawack.

The development is kindly supported by Variomedia AG.

A full list of contributors can be found on GitHub’s overview.

 
File Type Py Version Uploaded on Size
pem-17.1.0-py2.py3-none-any.whl (md5, pgp) Python Wheel py2.py3 2017-08-10 9KB
pem-17.1.0.tar.gz (md5, pgp) Source 2017-08-10 27KB