Package Crypto :: Package Util :: Module asn1 :: Class DerInteger
[frames] | no frames]

Class DerInteger

DerObject --+
            |
           DerInteger

Instance Methods
 
__init__(self, value=0)
Class to model an INTEGER DER element.
 
encode(self)
Return a complete INTEGER DER element, fully encoded as a TLV.
 
decode(self, derEle, noLeftOvers=0)
Decode a complete INTEGER DER element, and re-initializes this object with it.
    Inherited from DerObject
 
isType(self, ASN1Type)
Class Variables
    Inherited from DerObject
  typeTags = {'BIT STRING': 3, 'INTEGER': 2, 'NULL': 5, 'OBJECT ...
Method Details

__init__(self, value=0)
(Constructor)

 

Class to model an INTEGER DER element.

Limitation: only non-negative values are supported.

Overrides: DerObject.__init__

encode(self)

 
Return a complete INTEGER DER element, fully encoded as a TLV.
Overrides: DerObject.encode

decode(self, derEle, noLeftOvers=0)

 

Decode a complete INTEGER DER element, and re-initializes this object with it.

@param derEle A complete INTEGER DER element. It must start with a DER
INTEGER tag.
@param noLeftOvers Indicate whether it is acceptable to complete the
parsing of the DER element and find that not all bytes in derEle have been used.

@return Index of the first unused byte in the given DER element.

Raises a ValueError exception if the DER element is not a valid non-negative INTEGER. Raises an IndexError exception if the DER element is too short.

Overrides: DerObject.decode