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, 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.1.0 (2016-04-08)
Deprecations:
Passing dhParameters to pem.twisted.certifateOptionsFromPEMs and certificateOptionsFromFiles is now deprecated; instead, include the DH parameters in the PEM objects or files.
Backward-incompatible changes:
Python 3.3 and 2.6 aren’t supported anymore. They may work by chance but any effort to keep them working has ceased.
The last Python 2.6 release was on October 29, 2013 and isn’t supported by the CPython core team anymore. Major Python packages like Django and Twisted dropped Python 2.6 a while ago already.
Python 3.3 never had a significant user base and wasn’t part of any distribution’s LTS release.
Changes:
pem.twisted.certificateOptionsFromPEMs and certificateOptionsFromFiles will now load Ephemeral Diffie-Hellman parameters if found. [21]
PEM objects now correctly handle being constructed with unicode and bytes on both Python 2 and 3. [24]
PEM objects now have an as_bytes method that returns the PEM-encoded content as bytes, always. [24]
PEM objects are now hashable and comparable for equality. [25]
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-16.1.0.tar.gz
.
File metadata
- Download URL: pem-16.1.0.tar.gz
- Upload date:
- Size: 26.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4bf4ba29cd6e5db392ee7ccda9555e0765d6540a25d52bf9d90dcaccb817b170 |
|
MD5 | e2f8dfd5fdc5ae49f1994274dac77152 |
|
BLAKE2b-256 | 4f06cf51103b48532565adb42f562389d364e2075947c5b1cba79fdc7eae4e8d |
File details
Details for the file pem-16.1.0-py2.py3-none-any.whl
.
File metadata
- Download URL: pem-16.1.0-py2.py3-none-any.whl
- Upload date:
- Size: 15.8 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6b56282315e2e01dda7be7a0567268cbc8b602491bb408cb0cdd4bdcb7207fe0 |
|
MD5 | 8685c13f2cea0b0f8f60504d1667eefd |
|
BLAKE2b-256 | 4731950a775056ffafa5d8a914d98ae767b74c9bc66373546be790e12d76e985 |