]> Cypherpunks.ru repositories - pyderasn.git/commitdiff
Note about BIT/OCTET STRING primitive/constructed encodings
authorSergey Matveev <stargrave@stargrave.org>
Sun, 20 May 2018 13:21:53 +0000 (16:21 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Sun, 20 May 2018 13:25:55 +0000 (16:25 +0300)
pyderasn.py

index b28792c9e00e4c8459eff239210d0aaf9794c368..ee39e5793f944e8c010fc7d9c7641aa71945d75f 100755 (executable)
@@ -1927,6 +1927,14 @@ class BitString(Obj):
     ['nonRepudiation', 'keyEncipherment']
     >>> b.specs
     {'nonRepudiation': 1, 'digitalSignature': 0, 'keyEncipherment': 2}
+
+    .. note::
+
+       Pay attention that BIT STRING can be encoded both in primitive
+       and constructed forms. Decoder always checks constructed form tag
+       additionally to specified primitive one. If BER decoding is
+       :ref:`not enabled <bered_ctx>`, then decoder will fail, because
+       of DER restrictions.
     """
     __slots__ = ("tag_constructed", "specs", "defined")
     tag_default = tag_encode(3)
@@ -2357,6 +2365,14 @@ class OctetString(Obj):
     pyderasn.BoundsError: unsatisfied bounds: 4 <= 5 <= 4
     >>> OctetString(b"hell", bounds=(4, 4))
     OCTET STRING 4 bytes 68656c6c
+
+    .. note::
+
+       Pay attention that OCTET STRING can be encoded both in primitive
+       and constructed forms. Decoder always checks constructed form tag
+       additionally to specified primitive one. If BER decoding is
+       :ref:`not enabled <bered_ctx>`, then decoder will fail, because
+       of DER restrictions.
     """
     __slots__ = ("tag_constructed", "_bound_min", "_bound_max", "defined")
     tag_default = tag_encode(4)