Package: asn1
Python-ASN1 is a simple ASN.1 encoder and decoder for Python 2.7 and 3.5+.FeaturesSupport BER (parser) and DER (parser and generator) encoding (except indefinite lengths)100% python, compatible with version 2.7, 3.5 and higherCan be integrated by just including a file into your projectDependenciesPython-ASN1 relies onPython-Futurefor Python 2 and 3 compatibility. To install Python-Future:pipinstallfutureHow to install Python-asn1Install from PyPi with the following:pipinstallasn1or download the repository fromGitHuband install with the following:pythonsetup.pyinstallYou can also simply includeasn1.pyinto your project.How to use Python-asn1NoteYou can find more detailed documentation on theUsagepage.EncodingIf you want to encode data and retrieve its DER-encoded representation, use code such as:importasn1encoder=asn1.Encoder()encoder.start()encoder.write('1.2.3',asn1.Numbers.ObjectIdentifier)encoded_bytes=encoder.output()DecodingIf you want to decode ASN.1 from DER or BER encoded bytes, use code such as:importasn1decoder=asn1.Decoder()decoder.start(encoded_bytes)tag,value=decoder.read()DocumentationThe complete documentation is available on Read The Docs:python-asn1.readthedocs.ioLicensePython-ASN1 is free software that is made available under the MIT license.
Consult the file LICENSE that is distributed together with this library for
the exact licensing terms.CopyrightThe following people have contributed to Python-ASN1. Collectively they own the copyright of this software.Geert Jansen (geert@boskant.nl):original implementation.Sebastien Andrivet (sebastien@andrivet.com)Changelog2.7.0 (2023-01-17)Add context manager support (thanks to Mastermind-U)2.6.0 (2022-07-15)Add support for GeneralizedTime (thanks to vollkorntomate)2.5.0 (2022-03-03)Fixes to BitString decoding and encoding of IA5String and UTCTime (thanks to 0xbf00)2.4.2 (2021-10-29)Fix a minor mistake in the dump.py exampleAdd Python 3.9 and 3.102.4.1 (2020-07-16)Fix #89 - Replace explicit references to enum34 by enum-compat2.4.0 (2020-06-23)Fix #21 - Invalid decoding in non-Universal classesFix #57 - Invalid encoding of non-Universal classes2.3.1 (2020-04-06)No change in code, only in packaging and in texts (README, …)2.3.0 (2020-04-05)Tests: Replace nose by pytestAdd Python 3.8, remove Python 3.4 supportPR#26 (from rumbah): Add test for default (implicit) encoding typesPR#25 (from thomwiggers): Attempt to support BIT STRINGFix wrong example code, see #27(from jcrowgey) Makes the package usable with pip installRemove support of Python 3.3 (some dependencies do not support 3.3)PR#15 (from ThePlasmaRailgun) Fix parsing of object identifierPR#10 (from robinleander): Allow user to determine decoding tagtype2.2.0 (2017-10-30)Use “true” enums instead of classes. Use enun34 backport for old Python versions.2.1.1 (2017-10-30)Fix a bug (#9): two’s complement corner case with values such as -32769. Add new test cases to test them.2.1.0 (2016-12-18)Add more documentationUse (simulated) enumerationsAdd Python 2.6 in automated checks and testsAdd type hints (for static checking) and fix some code2.0.0 (2016-12-16)First public release by Sebastien AndrivetSupport both python 2 and 3 (with Python-Future)All strings are now in unicodeAdd more ASN.1 tags (like PrintableString)Fix errors in the example (dump.py)Code reorganization0.9 (2011-05-18)Initial public release by Geert Jansen