Skip to main content

Easy PEM file parsing in Python.

Project description

pem: Easy PEM file parsing

CI status Coverage

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.6, 2.7, 3.3, 3.4, and PyPy 2.0+, has no dependencies and does not attempt to interpret the certificate data in any way. pem is intended 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 while others (like nginx) expect them concatenated to the server certificate. To be able to cope with both scenarios in Python, pem was born:

>>> 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

16.0.0 (2016-02-05)

Changes:

  • PKCS #8 keys are now supported. [14]

  • pem is now fully functional without installing Twisted. [16]

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

Uploaded Source

Built Distribution

pem-16.0.0-py2.py3-none-any.whl (14.4 kB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

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

File hashes

Hashes for pem-16.0.0.tar.gz
Algorithm Hash digest
SHA256 1ad4548737f56b2573a2b9f33a9b07221486614cba4cb1a3e7336298285b3961
MD5 11bffe191fee271d224982e7b0f1d13c
BLAKE2b-256 b90e72553fbeb5308a185b03b55a0861cda74ec3789ee43849a84e190bc5beea

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pem-16.0.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 2f3046ef3503d325fdc7a8ff111a8364b1279ef882921c3685a45d69690b27b8
MD5 273176b9f02fc089f63c2b8261fa49bd
BLAKE2b-256 39c0e052ad47e51ab874ccbea3d65cf9590d840da686a1b5bbc08b512ee4dc0a

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