A pure Python ASN.1 library. Supports dict and sets.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
John-Mark Gurney 127ad4ed83 forgot to update copyright to 2020. 4 years ago
.gitignore ignore coverage file 7 years ago
Makefile make this work on python 3... 4 years ago
README.md talk about ASN1Coder in the readme. 8 years ago
pasn1.py forgot to update copyright to 2020. 4 years ago
requirements.txt make this work on python 3... 4 years ago
setup.py make this 1.0.1 since it now has a setup.py file.. 7 years ago

README.md

PASN1

This is a simple library for doing marshalling of python objects that uses a profile/subset of ASN.1. This library is not designed to be a general ASN.1 parser, but designed to be super simple to use, and secure.

The following python types are supported: bool, int (and long), bytes, null (as None), float, unicode, datetime, list, set and dict. If you need to serialize other types/instances, a coerce function maybe provided which is required to return the above string and an object implementing the correct methods. See the ASN1Coder’s init method’s doc string for more information.

ASN.1 has a number of different types of strings, but only UTF8String is used by this library. In order to support dict types, it uses the Private Constructed type 0. The contents are pairs of key value objects. bytes (aka str in Python 2) is mapped to the octet string type. The minimal encoding is used so that the same data will be encoded as the same string, similar to the ASN.1 DER encoding. The class ASN1Coder is available if the dict support is required to not be present.