skillfed

pem

PEM file parsing in Python.

pem v23.1.0 1.4M downloads/30d#3,906 on PyPI
Permissive license Abandoned released

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 pem

uv

uv add pem

poetry

poetry add pem

Installing 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

Development Status :: 5 - Production/StableLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Software Development :: Libraries :: Python Modules

Tags

pem file parsingcertificate parsing pythonextract keys from pemsplit pem certificatesparse ssl certificatespem file splittingcertificate chain parsing
certificate-parsingpem-formatzero-dependency

More Python Modules packages