asn1tinydecoder.py is a simple and fast ASN.1 decoder without external libraries designed to parse large files.

A widely used library for encoding and decoding ASN.1 in python is Pyasn1. This implementation covers many aspects of ASN.1, but the API is very complex and hard to learn. Furthermore Pyasn1 is not designed to parse large files. This why I wrote this tiny ASN.1 decoder. It’s design goal was to be as fast as possible (with Python 2)1.

A practical application can be found in search_serial_in_large_CRL.py This program creates an index allowing fast search in big ASN.1 data structures.

All python scripts including sample data to parse can be downloaded here.

The source code is hosted on Github https://github.com/getreu/asn1-tiny-decoder.

Read more online or download the pdf-rendition of the article.


1

Python 3 would have been a better choice for asn1tinedecoder.py because of its bytes type. Any volunteer for porting it Python 3?