| Home | Trees | Indices | Help |
|
|---|
|
|
object --+
|
DerObject --+
|
DerOctetString
Class to model a DER OCTET STRING.
An example of encoding is:
>>> from Crypto.Util.asn1 import DerOctetString >>> from binascii import hexlify, unhexlify >>> os_der = DerOctetString(b'\xaa') >>> os_der.payload += b'\xbb' >>> print hexlify(os_der.encode())
which will show 0402aabb, the DER encoding for the byte string b'\xAA\xBB'.
For decoding:
>>> s = unhexlify(b'0402aabb') >>> try: >>> os_der = DerOctetString() >>> os_der.decode(s) >>> print hexlify(os_der.payload) >>> except (ValueError, EOFError): >>> print "Not a valid DER OCTET STRING"
the output will be aabb.
| Instance Methods | |||
|
|||
|
Inherited from |
|||
| Inherited from DerObject | |||
|---|---|---|---|
|
|||
|
|||
| Properties | |
|
Inherited from |
| Method Details |
|
| Home | Trees | Indices | Help |
|
|---|
| Generated by Epydoc 3.0.1 on Mon Sep 7 14:45:24 2020 | http://epydoc.sourceforge.net |