2 files were added to this release more than 14 days after its initial publication. Inspect the release files before installing.
asn1ate – ASN.1 translation library. Copyright 2013-2017 Schneider Electric Buildings AB
Introduction
asn1ate is a Python library for translating ASN.1 into other forms. It is intended for code generation from formal ASN.1 definitions, and a code generator for pyasn1 is included.
asn1ate is released under a 3-clause BSD license. For details, see LICENSE.txt.
Caveat
This is very much an alpha-quality prototype. Things that need doing:
Regression test suite
HACK/TODO/BUGs need to be fixed
ASN.1 grammar is very incomplete in some places. Known issues:
Constraint syntax is currently limited to simple value range constraints (ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-12/pkcs-12.asn, line 53)
Reference syntax is not accepted at all (ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-12/pkcs-12.asn, line 74)
Improve parser error handling/reporting
Allow for semantic analysis, e.g. validity check, warnings for problematic constructs, etc.
Usage
The immediate use of asn1ate is to generate pyasn1 definitions from ASN.1 definitions. The command to do this is:
$ python .../asn1ate/pyasn1gen.py source.asn1
It will print the pyasn1 equivalent of source.asn1 to stdout.
But asn1ate is also designed to be usable as a library, to allow reuse of the ASN.1 parser for custom code generation.
Caveat #2
My understanding of ASN.1 syntax and semantics is limited. As I learn and discover more, the design will change. I will always prioritize a better model before API stability for the foreseeable future.
So if you’re using asn1ate as a library for custom codegen, please be aware that every release will likely break something for you.
The in-tree pyasn1 code generator will be kept up-to-date, of course, and may serve as an example of different codegen tasks,
Dependencies
The only third-party dependency is pyparsing.
Although asn1ate was initially developed on Python 3.2, it has been tested with Python 2.7 and should port to older Python versions easily. Latest release tested with:
Python 3.6.3
Python 2.7.14
Design notes
The asn1ate package is designed along the same lines as a compiler with a driver, a parser, a semantic model and a convention for code generators.
parser.py – a tokenizing parser for ASN.1 per X.680. It currently recognizes a naive sub-set of X.680
sema.py – a semantic ASN.1 object model, which can be constructed from the AST generated by parser.py
support/pygen.py – a support library for generating Python code.
pyasn1gen.py – a code generator to transform a semantic model into pyasn1 syntax. This can be used as a script in which case it will dump output to stdout.
The ASN.1 parser is very ad-hoc, I’ve experimented with the grammar until I found something that accepted our proprietary ASN.1 definition. It’s based on pyparsing but sets up parse actions to build an annotated AST. Every node of interest is annotated with a string denoting its type, e.g. Identifier, TypeAssignment, etc. I’ve tried to stay with token types as named in X.680, but added custom ones or suppressed others, as necessary to get the AST in a useful shape.
Annotated tokens are represented by a simple class containing the type name and a list of children (called elements) which may be annotated tokens, lists or simple values. This gives a very discoverable tree structure, but there are probably cleaner AST representations we could use. Patches welcome.
asn1ate.sema is an object model that represents ASN.1 constructs. It describes everything from type assignments to default values and tags, but still only the parts of ASN.1 we happen to use here. Most of the logic revolves around transforming the AST produced by asn1ate.parser into a more semantic model with proper Python objects.
Codegen is designed to be extensible. In-house we have a set of code generators to build an entire protocol stack based on an ASN.1 source, but asn1ate only includes the generally useful one, asn1ate.pyasn1gen.
The most notable members of asn1ate.support are probably the PythonWriter and PythonFragment classes, which simplify generation of correctly indented Python code.
Metadata
Release files for asn1ate 0.6.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Files added late
2 files were uploaded more than 14 days after the first file in this release.
While project maintainers occasionally add legitimate files to an existing release, late additions can also indicate a security compromise.
We recommend inspecting the release files before installing.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| asn1ate-0.6.0.tar.gz | 24.9 kB | Without provenance | Details for asn1ate-0.6.0.tar.gz |
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| asn1ate-0.6.0-py3-none-any.whl | Python 3 | none | any | Details for asn1ate-0.6.0-py3-none-any.whl |
| asn1ate-0.6.0-py2-none-any.whl | Python 2 | none | any | Details for asn1ate-0.6.0-py2-none-any.whl |
Total release size: 83.3 kB
Release files / asn1ate-0.6.0.tar.gz
| Download URL | asn1ate-0.6.0.tar.gz |
|---|---|
| Size | 24.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fe2cb928b1187cbd255272f2dc1df600f42d8810845b65e0f8d0551fbcd2c7ab
|
|
BLAKE2b-256 checksum How to use checksums |
ec207310475955a893ddd0beb7c8a9b1f940390d67bc46cae9d60c7bc7566d5c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / asn1ate-0.6.0-py3-none-any.whl
File added late
This file was uploaded more than 14 days after the first file in this release.
While project maintainers occasionally add legitimate files to an existing release, late additions can also indicate a security compromise.
We recommend inspecting the release file before installing.
| Download URL | asn1ate-0.6.0-py3-none-any.whl |
|---|---|
| Size | 29.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
521166d237e7d559913317111b31cadee92619282e152228417c195d6d9d3a9f
|
|
BLAKE2b-256 checksum How to use checksums |
c61f96f09ecca1ebc436327fb6c8148f9a24923d5e735689f86262b03e0af12c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.5
|
Release files / asn1ate-0.6.0-py2-none-any.whl
File added late
This file was uploaded more than 14 days after the first file in this release.
While project maintainers occasionally add legitimate files to an existing release, late additions can also indicate a security compromise.
We recommend inspecting the release file before installing.
| Download URL | asn1ate-0.6.0-py2-none-any.whl |
|---|---|
| Size | 29.2 kB |
| Tags | Python 2 |
|
SHA-256 checksum How to use checksums |
8f0ded3f26e3d5d7cc1d40b7b9d374c13992842fa2bb0885c10fb462d01f6293
|
|
BLAKE2b-256 checksum How to use checksums |
687e00dd31317ecfbc67580d14de5c3af9c36978b8b46224cdc248e088a097db
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.5
|
Security for asn1ate 0.6.0
Upload timing
Files added late
2 files were uploaded more than 14 days after the first file in this release.
While project maintainers occasionally add legitimate files to an existing release, late additions can also indicate a security compromise.
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.