pyasn1-modules

0.4.2 · active · verified Sat Mar 28

pyasn1-modules is a collection of ASN.1-based protocol modules for Python, built upon the pyasn1 library. The current version is 0.4.2, released on March 28, 2025. The library is actively maintained, with updates addressing compatibility and support for newer Python versions.

Warnings

Install

Imports

Quickstart

Decoding a DER-encoded X.509 certificate using pyasn1-modules.

from pyasn1_modules import rfc2459
from pyasn1.codec.der import decoder

# Example DER-encoded certificate (incomplete for brevity)
der_encoded_cert = b'...'

# Decode the certificate
cert, _ = decoder.decode(der_encoded_cert, asn1Spec=rfc2459.Certificate())

# Access certificate fields
subject = cert['tbsCertificate']['subject']
print('Subject:', subject)

view raw JSON →