Skip to main content

Easy PEM file parsing in Python.

Project description

pem: Easy PEM file parsing

Latest Version 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.

Credits

pem is written and maintained by Hynek Schlawack.

The development is kindly supported by Variomedia AG.

Contributors

The following wonderful people contributed directly or indirectly to this project:

Please add yourself here alphabetically when you submit your first pull request.

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

Uploaded Source

Built Distribution

pem-15.0.0-py2.py3-none-any.whl (14.3 kB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

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

File hashes

Hashes for pem-15.0.0.tar.gz
Algorithm Hash digest
SHA256 89ee757da1d02e050052892ecdb155bbc127b2676757b7fa8e660e148c526594
MD5 c1fe776cdd46fbfe4daafa229edb9915
BLAKE2b-256 4c8dd0f98f3137467ae2a2ff929d432922483e38b233abc91df9c3419c0d8788

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pem-15.0.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 6c034feee2a79dc646954ff3a33c87fcf731d01a36b4414e0c2aa6694af8c7aa
MD5 5a670575962e0b54e24b2373fb2bb35a
BLAKE2b-256 4ab56646fb5c6dd39d7f438a5579debe8833fe66348a85a00cff7c745e83d9df

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