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 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.4+, 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.1.0 (2019-03-19)

Backward-incompatible changes:

none

Deprecations:

none

Changes:

  • You can now load encrypted PKCS#8 PEM key as pem.Key.

  • Added support for pem.PublicKey (PUBLIC KEY).

  • Added support for pem.RSAPublicKey (RSA PUBLIC KEY).

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

Uploaded Source

Built Distribution

pem-19.1.0-py2.py3-none-any.whl (7.8 kB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

  • Download URL: pem-19.1.0.tar.gz
  • Upload date:
  • Size: 34.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.1.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.7.0

File hashes

Hashes for pem-19.1.0.tar.gz
Algorithm Hash digest
SHA256 0f0428fbe22cafa3eb973619a1c329aa886a24bbdafe138d3a46a084059dc0b1
MD5 d939d1e43f128066569d81460b3b80d7
BLAKE2b-256 29cb81e273e112fcc292306a4c93859da6beac1153d46db06a0399bef177eb2e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pem-19.1.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 7.8 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.1.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.7.0

File hashes

Hashes for pem-19.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 f18a51b43de7f3a49c45520975d929eb63bdb0b2e9ec78363d48b852866f3cf8
MD5 b8478dc953cd38f66fa2a75edede2a30
BLAKE2b-256 5b45e4b6ecb815c15fc34a33c121934f9242660f0971e15e0c7df8b4f87cbeed

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