skillfed

asn1tools

ASN.1 parsing, encoding and decoding.

asn1tools v0.167.0 557.1K downloads/30d#6,015 on PyPI335
Permissive license MIT DORMANT released

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 asn1tools

uv

uv add asn1tools

poetry

poetry add asn1tools

Installing 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

License :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 2Programming Language :: Python :: 3

Tags

ASN.1 parsing encoding decodingBER DER PER codecASN.1 message serializationbinary protocol encodingASN.1 C code generationstructured data encodingtelecommunication protocol parsing
asn1-codecbinary-protocoltelecom-standards

More Software Development packages