Skip to main content

Easy PEM file parsing in Python.

Project description

pem: Easy PEM file parsing

Documentation Status CI status Coverage https://www.irccloud.com/invite-svg?channel=%23cryptography-dev&hostname=irc.freenode.net&port=6697&ssl=1

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pem-17.1.0.tar.gz (27.8 kB view details)

Uploaded Source

Built Distribution

pem-17.1.0-py2.py3-none-any.whl (10.0 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file pem-17.1.0.tar.gz.

File metadata

  • Download URL: pem-17.1.0.tar.gz
  • Upload date:
  • Size: 27.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pem-17.1.0.tar.gz
Algorithm Hash digest
SHA256 80c83846e927139773f79cdc581f8e276eb7b3f7a0f0a08c7dabe8e51374b97b
MD5 19fb144acee4ae8dea020fb5579f2fdc
BLAKE2b-256 150efd45c79118dbbe11fd8f906390edef167b3b4552c9ff0b676dcf1c2fd8c5

See more details on using hashes here.

File details

Details for the file pem-17.1.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for pem-17.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 f64f0eb25f700a83cbb21b8f82a1a470f0fd75865e2c84606b3f912b01f65f48
MD5 5b8b3c92bed577cf5286e885a1e6adf4
BLAKE2b-256 c567334ded5b53377a171b66fcbc0c8b8e90bed1be6cb4334377406cb1c99030

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page