pem
PEM file parsing in Python.
What it is and what it does
pem is a lightweight Python library for parsing and extracting individual certificates, keys, and certificate chains from PEM-formatted files. It handles the common problem of different servers expecting certificate components in different arrangements—some require separate files, others concatenated, others combined—by providing simple parsing that works across all scenarios.
The library contains no runtime dependencies and does not validate or interpret certificate contents; it purely extracts and splits PEM-encoded blocks. It also includes helpers for Twisted to reduce boilerplate when loading PEM data into Twisted SSL certificate objects. The package supports Python 3.8 through 3.12 and is classified as production/stable.
Use it for:
- Extract individual certificates from a concatenated PEM chain file for use with servers that require separate certificate files.
- Parse mixed PEM files containing keys, certificates, and chains to reorganize them for different server configurations.
- Load PEM data into Twisted SSL Certificate objects using built-in helper functions.
- Programmatically split OpenPGP keys and certificates from PEM files for cryptographic operations.
- Read certificate chains from disk and access individual components via the parsed PEM objects.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Parses and splits PEM files (Base64-encoded DER keys and certificates) without interpreting the certificate data itself, handling various certificate deployment scenarios.
Yes, if you need straightforward PEM parsing with zero dependencies and your use case does not require ongoing maintenance or security updates. The library is stable and handles its narrow scope well, but the abandoned status (no releases since June 2023) means no fixes for future Python or certificate standard changes. Suitable for stable, long-lived applications that do not depend on active upstream support.
Install
pem on PyPI
pip
pip install pemuv
uv add pempoetry
poetry add pemInstalling pem
Before you install
Low install friction with no runtime dependencies. However, the package is marked as abandoned with no releases for 1150 days, which may affect long-term maintenance and security updates.
License in practice
Licensed under MIT (permissive), allowing free use, modification, and distribution with minimal restrictions.
Quickstart
import pem
certs = pem.parse_file("chain.pem")
print(str(certs[0]))
Verify before relying
- Whether the lack of updates since June 2023 affects compatibility with current Python or certificate standards.
- Whether Twisted integration helpers remain functional with current Twisted versions.
Package facts
| License | not declared (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | abandoned — 1,150 days since the last release |
| First released | |
| Downloads | 1,433,597/month — #3,906 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pem-23.1.0-py3-none-any.whl
Keywords: cryptography, pem, pyopenssl, ssl, tls, twisted
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
asn1cryptoA pure Python library for parsing and…
permissive · top 1,000 on PyPI
pyas2libBuilds and parses AS2 protocol messages with…
copyleft · top 15,000 on PyPI
trustmetrustme generates fake TLS certificates and…
permissive · top 5,000 on PyPI
acmeImplements the ACME protocol to automate…
permissive · top 5,000 on PyPI
wincertstoreAccesses Windows system certificate stores (CA…
permissive · top 15,000 on PyPI
docker-image-pyParses Docker image reference strings into…
permissive · top 5,000 on PyPI
certbotCertbot is a command-line client that…
permissive · top 15,000 on PyPI
certifiCertifi provides Mozilla's curated collection…
copyleft · top 100 on PyPI
apkutils2Parses Android APK files to extract and display…
permissive · top 15,000 on PyPI
tls-parserParses TLS records from binary data, extracting…
unclear · top 15,000 on PyPI