asn1tools
ASN.1 parsing, encoding and decoding.
What it is and what it does
asn1tools is a Python library for working with ASN.1 (Abstract Syntax Notation One), a standard format for defining structured data used in telecommunications, cryptography, and network protocols. It compiles ASN.1 specification files and provides encode/decode operations across eight codec standards—BER, DER, PER, UPER, OER, XER, JER, and GSER—allowing you to serialize Python dictionaries into binary or text formats and deserialize them back. It also includes command-line tools for converting between formats and a C source code generator for OER and UPER codecs when you need compiled performance.
The library supports a subset of the ASN.1 specification; it does not yet handle CLASS keywords, parametrization, EMBEDDED PDV, ANY types, or DURATION types. The C generator requires all types to have known maximum sizes and works only with a limited set of ASN.1 primitives. Installation is high-friction due to the source-only distribution, and maintenance is dormant—the last release was 762 days ago, though the repository remains accessible.
Use it for:
- Decode binary protocol messages from telecom standards that use ASN.1 encoding.
- Convert between ASN.1 codecs (e.g., BER to human-readable GSER or JSON) for debugging and protocol analysis.
- Encode structured data into OER or UPER for bandwidth-constrained or real-time network applications.
- Generate C source code for embedded systems or performance-critical ASN.1 encoding/decoding.
- Parse and validate ASN.1 specifications as part of a protocol implementation or code generation pipeline.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Parses, encodes, and decodes ASN.1 messages using multiple codec standards including BER, DER, PER, UPER, OER, XER, JER, and GSER, plus generates C source code for OER and UPER encoding.
Yes, if you work with ASN.1 protocols and can tolerate high install friction and dormant maintenance. The library covers a broad range of codecs and includes useful command-line tools. No, if you need active maintenance, recent bug fixes, or support for the full ASN.1 specification—consider alternatives or fork the repository if your use case is critical.
Install
asn1tools on PyPI
pip
pip install asn1toolsuv
uv add asn1toolspoetry
poetry add asn1toolsInstalling asn1tools
Before you install
High install friction: the package is a source distribution (asn1tools-0.167.0.tar.gz) with no runtime dependencies listed, suggesting it may require compilation or system-level dependencies not declared in the metadata. Maintenance is dormant—last release was 762 days ago, though the repository remains active with a recent commit on 2024-07-13.
License in practice
MIT license is permissive and places minimal restrictions on use, modification, and distribution. You may use this package in commercial and proprietary projects with only attribution required.
Quickstart
import asn1tools
foo = asn1tools.compile_files('foo.asn')
encoded = foo.encode('Question', {'id': 1, 'question': 'Is 1+1=3?'})
decoded = foo.decode('Question', encoded)
Requires an ASN.1 specification file (.asn) to compile before encoding/decoding. High install friction may require build tools or system libraries.
Verify before relying
- Whether the source distribution requires a C compiler or other system-level build dependencies beyond what pip normally provides.
- Current stability and whether the dormant maintenance status affects production readiness for new ASN.1 specifications.
- Support coverage for the full ASN.1 specification beyond the documented subset of supported types and features.
Package facts
| License | MIT (permissive) |
| Python support | not specified |
| Install friction | high — source build required |
| Runtime dependencies | none |
| Maintenance | dormant — 762 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 557,056/month — #6,015 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: asn1tools-0.167.0.tar.gz
Keywords: ASN.1, asn1
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
asn1Encodes and decodes ASN.1 data structures using…
permissive · top 5,000 on PyPI
pyasn1Pyasn1 encodes and decodes ASN.1 data…
permissive · top 100 on PyPI
x690Encodes and decodes data using the X.690 BER…
permissive · top 15,000 on PyPI
asn1cryptoA pure Python library for parsing and…
permissive · top 1,000 on PyPI
pyasn1-modulesProvides a collection of ASN.1 data structures…
permissive · top 100 on PyPI
mbstrdecoderDecodes multi-byte character strings by…
permissive · top 5,000 on PyPI
pysmi-lextudioParses ASN.1 SNMP MIB files and converts them…
permissive · top 15,000 on PyPI
scalecodecEncodes and decodes data using the SCALE codec,…
permissive · top 15,000 on PyPI
pysmiPySMI parses SNMP MIB files in ASN.1 format and…
permissive · top 5,000 on PyPI