Easy PEM file parsing in Python.
Project description
pem: Easy PEM file parsing
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.1.0 (2021-01-22)
Backward-incompatible changes:
none
Deprecations:
none
Changes:
Added support for DSA private keys (BEGIN DSA PRIVATE). This is also the OpenSSH legacy PEM format. #49
Added support for pem.SSHPublicKey (---- BEGIN SSH2 PUBLIC KEY ----), as defined in RFC 4716. #46
Added support for pem.SSHCOMPrivateKey (---- BEGIN SSH2 ENCRYPTED PRIVATE KEY ----), the SSH.com / Tectia private key format (plain or encrypted). #46
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pem-21.1.0.tar.gz
.
File metadata
- Download URL: pem-21.1.0.tar.gz
- Upload date:
- Size: 35.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.3.3 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dddbc395740ed3fcd2940068d190e7071e8b12a9d57b76a2f080e7ca8397b310 |
|
MD5 | 195dc75f0ea6b9b06100166770a0fb87 |
|
BLAKE2b-256 | aef843fd26ac249cf81350d4d5a68b18fa51e158b93476f7fa5e2f653865ecf4 |
File details
Details for the file pem-21.1.0-py2.py3-none-any.whl
.
File metadata
- Download URL: pem-21.1.0-py2.py3-none-any.whl
- Upload date:
- Size: 8.9 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.3.3 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.9.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d499fab0bd8dcf6c50360c9c359664d572e01c4388f96fa05fab93049cd61c5e |
|
MD5 | f2dd7184d092acd2362230f79a9ca699 |
|
BLAKE2b-256 | fd6ed39572eb4434064c1057940811c36756f006d6a39365c4ba995e334ae72b |