]> Cypherpunks.ru repositories - pyderasn.git/blob - doc/features.rst
Limitations section
[pyderasn.git] / doc / features.rst
1 Features
2 ========
3
4 * BER/CER/DER decoding, DER encoding
5 * Basic ASN.1 data types (X.208): BOOLEAN, INTEGER, BIT STRING, OCTET
6   STRING, NULL, OBJECT IDENTIFIER, ENUMERATED, all strings, UTCTime,
7   GeneralizedTime, CHOICE, ANY, SEQUENCE (OF), SET (OF)
8 * Size :ref:`constraints <bounds>` checking
9 * Working with sequences as high level data objects with ability to
10   (un)marshall them
11 * Python 2.7/3.5/3.6 compatibility
12 * Aimed to be complaint with `X.690-201508 <https://www.itu.int/rec/T-REC-X.690-201508-I/en>`__
13
14 Why yet another library? `pyasn1 <http://snmplabs.com/pyasn1/>`__
15 had all of this a long time ago. PyDERASN resembles it in many ways. In
16 practice it should be relatively easy to convert ``pyasn1``'s code to
17 ``pyderasn``'s one. But additionally it offers:
18
19 * Small, simple and trying to be reviewable code. Just a single file
20 * Automatic decoding of :ref:`DEFINED BY <definedby>` fields
21 * Ability to know :ref:`exact decoded <decoding>` objects offsets and
22   lengths inside the binary
23 * :ref:`Pretty printer <pprinting>` and command-line decoder, that could
24   conveniently replace utilities like either ``dumpasn1`` or
25   ``openssl asn1parse``
26 * Some kind of strong typing: SEQUENCEs require the exact **type** of
27   settable values, even when they are inherited
28 * However they do not require tags matching: IMPLICIT/EXPLICIT tags will
29   be set automatically in the given sequence
30 * Descriptive errors, like ``pyderasn.DecodeError: UTCTime
31   (tbsCertificate:validity:notAfter:utcTime) (at 328) invalid UTCTime format``
32 * ``__slots__`` friendliness
33 * Could be significantly faster. For example parsing of CACert.org's CRL
34   under Python 3.5.2:
35
36     :``python -m pyderasn revoke.crl``:
37      ~2 min (``pyderasn == 1.0``)
38     :``python -m pyderasn --schema path.to.CertificateList revoke.crl``:
39      ~38 sec (``pyderasn == 1.0``)
40     :``pyasn1.decode(asn1Spec=pyasn1.CertificateList())``:
41      ~22 min (``pyasn1 == 0.2.3``)
42
43 There are drawbacks:
44
45 * No old Python versions support
46 * See :ref:`limitations <limitations>`