Skip to main content

Easy PEM file parsing in Python.

Project description

pem: Easy PEM file parsing

PyPI Documentation Status CI Status Coverage https://www.irccloud.com/invite-svg?channel=%23cryptography-dev&hostname=irc.freenode.net&port=6697&ssl=1 Code style: black Checked with mypy

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.5+, and PyPy, has no dependencies, and does not attempt to interpret the certificate data in any way.

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

19.3.0 (2019-10-16)

Backward-incompatible changes:

  • Python 3.4 is not supported anymore. It has been unsupported by the Python core team for a while now and its PyPI downloads are negligible.

    It’s very unlikely that pem will break under 3.4 anytime soon, but we don’t test it anymore.

Deprecations:

none

Changes:

  • Added support for pem.OpenSSHPrivateKey (OPENSSH PRIVATE KEY). OpenSSH added a new BEGIN label when it switched to a proprietary key encoding. #39

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-19.3.0.tar.gz (38.7 kB view details)

Uploaded Source

Built Distribution

pem-19.3.0-py2.py3-none-any.whl (8.6 kB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

  • Download URL: pem-19.3.0.tar.gz
  • Upload date:
  • Size: 38.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.4

File hashes

Hashes for pem-19.3.0.tar.gz
Algorithm Hash digest
SHA256 d10058932ec7b9bbc81c40862275395b9faa287353a9152b642393e7efcdb526
MD5 00051a57511df1f33b801fcf9b91e8cf
BLAKE2b-256 568696e340a690a8ee4e95fa5e9d056db698c70372a608b91dfa8725a3587134

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pem-19.3.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 8.6 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.4

File hashes

Hashes for pem-19.3.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 ed52902bfee8e7f75c5242538ec4cbab0079cba5cfc7fa260588f5204e12fd9c
MD5 cee5b2d99ebc1ecba3c168f03f9fb953
BLAKE2b-256 6155292eed779791d229bbc387bf3225714ebceb6f2197dde24e4057a54a1806

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