Your IP : 172.28.240.42


Current Path : /usr/lib/python2.7/dist-packages/Crypto/Util/
Upload File :
Current File : //usr/lib/python2.7/dist-packages/Crypto/Util/asn1.pyc


T:Nc@s~ddlmZmZddlZddlTdddgZdd
dYZdefdYZdefd	YZdS(i(t
long_to_bytest
bytes_to_longN(t*t	DerObjectt
DerIntegertDerSequencecBsheZiedd6edd6edd6ZddZdZdZd	Zd
dZ	RS(
t0tSEQUENCEss
BIT STRINGstINTEGERcCs+|jj|||_td|_dS(Nt(ttypeTagstgetttypeTagtbtpayload(tselftASN1Type((s4/usr/lib/python2.7/dist-packages/Crypto/Util/asn1.pyt__init__ scCs:|dkr0t|}tt|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).
        ii(Rtbchrtlen(Rt
payloadLentencoding((s4/usr/lib/python2.7/dist-packages/Crypto/Util/asn1.pyt
_lengthOctets$scCs$|j|jt|j|jS(N(RRRR(R((s4/usr/lib/python2.7/dist-packages/Crypto/Util/asn1.pytencode/scCst||}|dkr*||dfSt||d|d|d@!}|dkrhtdn||d|d@fSdS(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.
        iisNot a DER length tag.N(tbordRt
ValueError(Rtidxtstrtlengtht
payloadLength((s4/usr/lib/python2.7/dist-packages/Crypto/Util/asn1.pyt
_decodeLen2s#icCsy|d|_t|jd@dkr8tdn|jd|\}}|r{t|||kr{tdn||||!|_Wntk
rtdnX||S(NiisUnsupported DER tagisNot a DER structuresNot a valid DER SEQUENCE.(RRRRRRt
IndexError(RtinputtnoLeftOversRR((s4/usr/lib/python2.7/dist-packages/Crypto/Util/asn1.pytdecodeAs

N(
t__name__t
__module__R
R
tNoneRRRRR"(((s4/usr/lib/python2.7/dist-packages/Crypto/Util/asn1.pyRs-			cBs)eZddZdZddZRS(icCstj|d||_dS(NR(RRtvalue(RR&((s4/usr/lib/python2.7/dist-packages/Crypto/Util/asn1.pyROscCsQt|j|_t|jddkrDtd|j|_ntj|S(Niit(RR&RRR
RR(R((s4/usr/lib/python2.7/dist-packages/Crypto/Util/asn1.pyRSscCsStj|||}t|jddkr=tdnt|j|_|S(NiisNegative INTEGER.(RR"RRRRR&(RR R!t	tlvLength((s4/usr/lib/python2.7/dist-packages/Crypto/Util/asn1.pyR"Ys
(R#R$RRR"(((s4/usr/lib/python2.7/dist-packages/Crypto/Util/asn1.pyRNs	cBseZdZdZdZdZejddkr[dZdZ	dZ
nd	Zd
ZdZ
dZdd
ZRS(cCstj|dg|_dS(NR(RRt_seq(R((s4/usr/lib/python2.7/dist-packages/Crypto/Util/asn1.pyRascCs|j|=dS(N(R)(Rtn((s4/usr/lib/python2.7/dist-packages/Crypto/Util/asn1.pyt__delitem__dscCs|j|S(N(R)(RR*((s4/usr/lib/python2.7/dist-packages/Crypto/Util/asn1.pyt__getitem__fscCs||j|<dS(N(R)(RtkeyR&((s4/usr/lib/python2.7/dist-packages/Crypto/Util/asn1.pyt__setitem__hsiicCs||j||+dS(N(R)(Rtitjtsequence((s4/usr/lib/python2.7/dist-packages/Crypto/Util/asn1.pyt__setslice__kscCs|j||5dS(N(R)(RR/R0((s4/usr/lib/python2.7/dist-packages/Crypto/Util/asn1.pyt__delslice__mscCs |jtd|td|!S(Ni(R)tmax(RR/R0((s4/usr/lib/python2.7/dist-packages/Crypto/Util/asn1.pyt__getslice__oscCs
t|jS(N(RR)(R((s4/usr/lib/python2.7/dist-packages/Crypto/Util/asn1.pyt__len__qscCs|jj|S(N(R)tappend(Rtitem((s4/usr/lib/python2.7/dist-packages/Crypto/Util/asn1.pyR7sscCsN|js
dSd}x4|jD])}y||7}Wqtk
rEdSXqWdS(Nii(R)t	TypeError(RttestR8((s4/usr/lib/python2.7/dist-packages/Crypto/Util/asn1.pythasOnlyIntsvs	
	cCstd|_xc|jD]X}y|j|7_Wqy|jt|j7_WqqtdqqXqXqWtj|S(s
        Return the DER encoding for the ASN.1 SEQUENCE containing
        the non-negative integers and longs added to this object.
        R	s&Trying to DER encode an unknown object(R
RR)RRRR(RR8((s4/usr/lib/python2.7/dist-packages/Crypto/Util/asn1.pyRsc	Cs5g|_ytj|||}|j|jddkrJtdnd}x|t|jkr|j|}||jddkrt}||j|j|7}|jj	|j
qS|j|d|j\}}|jj	|j|||!||}qSWWntk
r0tdnX|S(s

        This function decodes the given string into a sequence of
        ASN.1 objects. Yet, we only know about unsigned INTEGERs.
        Any other type is stored as its rough TLV. In the latter
        case, the correctectness of the TLV is not checked.
        RisNot a DER SEQUENCE.RisNot a valid DER SEQUENCE.(
R)RR"RR
RRRRR7R&RR(	RR R!R(RRt
newIntegertitemLentitemIdx((s4/usr/lib/python2.7/dist-packages/Crypto/Util/asn1.pyR"s$	
	
(R#R$RR+R,R.tsystversion_infoR2R3R5R6R7R;RR"(((s4/usr/lib/python2.7/dist-packages/Crypto/Util/asn1.pyR`s									
	((	tCrypto.Util.numberRRR?tCrypto.Util.py3compatt__all__RRR(((s4/usr/lib/python2.7/dist-packages/Crypto/Util/asn1.pyt<module>s
1