Skip to main content

Easy PEM file parsing in Python.

Project description

pem: Easy PEM file parsing

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

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, and 3.5+, 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 is available from PyPI, its documentation lives at Read the Docs, the code on GitHub.

Release Information

21.2.0 (2021-04-07)

Backward-incompatible changes:

none

Deprecations:

none

Changes:

  • Added support for pem.OpenSSLTrustedCertificate (-----BEGIN TRUSTED CERTIFICATE-----), as defined in openssl x509 manual. #28

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

Uploaded Source

Built Distribution

pem-21.2.0-py2.py3-none-any.whl (8.8 kB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

  • Download URL: pem-21.2.0.tar.gz
  • Upload date:
  • Size: 35.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

File hashes

Hashes for pem-21.2.0.tar.gz
Algorithm Hash digest
SHA256 c491833b092662626fd58a87375d450637d4ee94996ad9bbbd42593428e93e5a
MD5 440c999aadbc9be74d4bc3ab17fa7e1c
BLAKE2b-256 485778c8edb8a241fe2ae8f19bc7d5fe73c2f23e648fd38408e821fb6929f784

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pem-21.2.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

File hashes

Hashes for pem-21.2.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 64afb669f05502c071d0706ee66e51471718ae248ba39624919da7b4ea73506e
MD5 a35bd1fb7e0a30ce657ffbd16d19efe4
BLAKE2b-256 1c5e357bb7aaed725299beb12cfbe36ac870648d3cb5e65c9086155d67536678

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