Current Path : /usr/lib/python2.7/dist-packages/Crypto/Util/ |
Current File : //usr/lib/python2.7/dist-packages/Crypto/Util/asn1.pyc |
T:Nc @ s~ d d l m Z m Z d d l Z d d l Td d d g Z d d d YZ d e f d YZ d e f d YZ d S( i( t long_to_bytest bytes_to_longN( t *t DerObjectt DerIntegert DerSequencec B sh e Z i e d d 6e d d 6e d d 6Z d d Z d Z d Z d Z d d Z RS( t 0t SEQUENCEs s BIT STRINGs t INTEGERc C s+ | j j | | | _ t d | _ d S( Nt ( t typeTagst gett typeTagt bt payload( t selft ASN1Type( ( s4 /usr/lib/python2.7/dist-packages/Crypto/Util/asn1.pyt __init__ s c C s: | d k r0 t | } t t | d | St | S( s Return an octet string that is suitable for the BER/DER length element if the relevant payload is of the given size (in bytes). i i ( R t bchrt len( R t payloadLent encoding( ( s4 /usr/lib/python2.7/dist-packages/Crypto/Util/asn1.pyt _lengthOctets$ s c C s$ | j | j t | j | j S( N( R R R R ( R ( ( s4 /usr/lib/python2.7/dist-packages/Crypto/Util/asn1.pyt encode/ s c C s t | | } | d k r* | | d f St | | d | d | d @! } | d k rh t d n | | d | d @f Sd S( s Given a string and an index to a DER LV, this function returns a tuple with the length of V and an index to the first byte of it. i i s Not a DER length tag.N( t bordR t ValueError( R t idxt strt lengtht payloadLength( ( s4 /usr/lib/python2.7/dist-packages/Crypto/Util/asn1.pyt _decodeLen2 s #i c C s y | d | _ t | j d @d k r8 t d n | j d | \ } } | r{ t | | | k r{ t d n | | | | !| _ Wn t k r t d n X| | S( Ni i s Unsupported DER tagi s Not a DER structures Not a valid DER SEQUENCE.( R R R R R R t IndexError( R t inputt noLeftOversR R ( ( s4 /usr/lib/python2.7/dist-packages/Crypto/Util/asn1.pyt decodeA s N( t __name__t __module__R R t NoneR R R R R"