Home | Trees | Indices | Help |
|
---|
|
object --+ | DerObject --+ | DerBitString
Class to model a DER BIT STRING.
An example of encoding is:
>>> from Cryptodome.Util.asn1 import DerBitString >>> from binascii import hexlify, unhexlify >>> bs_der = DerBitString(b'\xaa') >>> bs_der.value += b'\xbb' >>> print hexlify(bs_der.encode())
which will show 040300aabb, the DER encoding for the bit string b'\xAA\xBB'.
For decoding:
>>> s = unhexlify(b'040300aabb') >>> try: >>> bs_der = DerBitString() >>> bs_der.decode(s) >>> print hexlify(bs_der.value) >>> except ValueError: >>> print "Not a valid DER OCTET STRING"
the output will be aabb.
Instance Methods | |||
|
|||
|
|||
|
|||
Inherited from |
Properties | |
Inherited from |
Method Details |
|
|
|
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Thu Feb 16 14:05:21 2017 | http://epydoc.sourceforge.net |