403Webshell
Server IP : 192.158.238.246  /  Your IP : 3.147.48.123
Web Server : LiteSpeed
System : Linux uniform.iwebfusion.net 4.18.0-553.27.1.lve.1.el8.x86_64 #1 SMP Wed Nov 20 15:58:00 UTC 2024 x86_64
User : jenniferflocom ( 1321)
PHP Version : 8.1.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/alt/python37/lib64/python3.7/site-packages/Crypto/Util/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/alt/python37/lib64/python3.7/site-packages/Crypto/Util/__pycache__/asn1.cpython-37.opt-1.pyc
B

q~�^�1�@s�ddlmZmZddlZddlTdddddd	gZGd
d�d�ZGdd�de�ZGdd�de�ZGd
d�de�Z	Gdd�de�Z
Gdd	�d	e�Zdd�ZdS)�)�
long_to_bytes�
bytes_to_longN)�*�	DerObject�
DerInteger�DerOctetString�DerNull�DerSequence�DerObjectIdc@s^eZdZdZddddddd�Zd	ed
�fdd�Zd
d�Zdd�Zdd�Z	dd�Z
ddd�Zd	S)rz�Base class for defining a single DER object.

        Instantiate this class ONLY when you have to decode a DER element.
        �0�����)�SEQUENCEz
BIT STRING�INTEGERzOCTET STRING�NULLzOBJECT IDENTIFIERN�cCsHt|�s|dkr||_n&t|�dkr0t|�|_n|j�|�|_||_dS)z�Initialize the DER object according to a specific type.

                The ASN.1 type is either specified as the ASN.1 string (e.g.
                'SEQUENCE'), directly with its numerical tag or with no tag
                at all (None).N�)�isInt�typeTag�len�ord�typeTags�get�payload)�self�ASN1Typer�r�C/opt/alt/python37/lib64/python3.7/site-packages/Crypto/Util/asn1.py�__init__'szDerObject.__init__cCs|j||jkS)N)rr)rrrrr �isType6szDerObject.isTypecCs,|dkr$t|�}tt|�d�|St|�S)z�Return a byte string that encodes the given payload length (in
                bytes) in a format suitable for a DER length tag (L).
                ��)r�bchrr)rZ
payloadLen�encodingrrr �
_lengthOctets9szDerObject._lengthOctetscCs t|j�|�t|j��|jS)z6Return a complete DER element, fully encoded as a TLV.)r%rr'rr)rrrr �encodeBszDerObject.encodecCsdt||�}|dkr ||dfSt||d|d|d@��}|dkrPtd��||d|d@fS)a�Given a (part of a) DER element, and an index to the first byte of
                a DER length tag (L), return a tuple with the payload size,
                and the index of the first byte of the such payload (V).

                Raises a ValueError exception if the DER length is invalid.
                Raises an IndexError exception if the DER element is too short.
                r#rzNot a DER length tag.)�bordr�
ValueError)r�idxZder�lengthZ
payloadLengthrrr �
_decodeLenFs zDerObject._decodeLenrcCs�yft|d�|_|jd@dkr&td��|�d|�\}}|rRt|�||krRtd��||||�|_Wntk
r�td��YnX||S)a�Decode a complete DER element, and re-initializes this
                object with it.

                @param derEle       A complete DER element. It must start with a DER T
                                    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 in case of parsing errors.
                Raises an IndexError exception if the DER element is too short.
                r�zUnsupported DER tagrzNot a DER structurezNot a valid DER SEQUENCE.)r)rr*r-rr�
IndexError)r�derEle�noLeftOversr,r+rrr �decodeVszDerObject.decode)r)�__name__�
__module__�__qualname__�__doc__r�br!r"r'r(r-r2rrrr rs	c@s(eZdZd	dd�Zdd�Zd
dd�ZdS)rrcCst�|d�||_dS)z|Class to model an INTEGER DER element.

                Limitation: only non-negative values are supported.
                rN)rr!�value)rr8rrr r!qszDerInteger.__init__cCs8t|j�|_t|jd�dkr.td�|j|_t�|�S)z>Return a complete INTEGER DER element, fully encoded as a TLV.rr#)rr8rr)r%rr()rrrr r(yszDerInteger.encodecCsPt�|||�}|j|jdkr&td��t|jd�dkr@td��t|j�|_|S)aDecode 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.
                rzNot a DER INTEGER.rr#zNegative INTEGER.)	rr2rrr*r)rrr8)rr0r1�	tlvLengthrrr r2�szDerInteger.decodeN)r)r)r3r4r5r!r(r2rrrr rps
c@s|eZdZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zddd�ZdS) r	aClass to model a SEQUENCE DER element.

        This object behave like a dynamic Python sequence.
        Sub-elements that are INTEGERs, look like Python integers.
        Any other sub-element is a binary string encoded as the complete DER
        sub-element (TLV).
        NcCs&t�|d�|dkrg|_n||_dS)zKInitialize the SEQUENCE DER object. Always empty
                initially.rN)rr!�_seq)rZstartSeqrrr r!�szDerSequence.__init__cCs|j|=dS)N)r:)r�nrrr �__delitem__�szDerSequence.__delitem__cCs
|j|S)N)r:)rr;rrr �__getitem__�szDerSequence.__getitem__cCs||j|<dS)N)r:)r�keyr8rrr �__setitem__�szDerSequence.__setitem__cCs||j||�<dS)N)r:)r�i�jZsequencerrr �__setslice__�szDerSequence.__setslice__cCs|j||�=dS)N)r:)rr@rArrr �__delslice__�szDerSequence.__delslice__cCs|jtd|�td|��S)Nr)r:�max)rr@rArrr �__getslice__�szDerSequence.__getslice__cCs
t|j�S)N)rr:)rrrr �__len__�szDerSequence.__len__cCs|j�|�S)N)r:�append)r�itemrrr rG�szDerSequence.appendcCstttt|j���S)z=Return the number of items in this sequence that are numbers.)r�list�filterrr:)rrrr �hasInts�szDerSequence.hasIntscCs|jo|��t|j�kS)z6Return True if all items in this sequence are numbers.)r:rKr)rrrr �hasOnlyInts�szDerSequence.hasOnlyIntsc
Csttd�|_x^|jD]T}y|j|7_Wqy|jt|���7_Wntd��YnXYqXqWt�|�S)a;Return the DER encoding for the ASN.1 SEQUENCE, containing
                the non-negative integers and longs added to this object.

                Limitation: Raises a ValueError exception if it some elements
                in the sequence are neither Python integers nor complete DER INTEGERs.
                rz&Trying to DER encode an unknown object)r7rr:rr(r*r)rrHrrr r(�s
zDerSequence.encoderc	Cs�g|_y�t�|||�}|j|jdkr.td��d}x�|t|j�kr�t|j|�}||jdkr�t	�}||�|j|d��7}|j�
|j�q4|�|d|j�\}}|j�
|j|||��||}q4WWnt
k
r�td��YnX|S)a�Decode a complete SEQUENCE DER element, and re-initializes this
                object with it.

                @param derEle       A complete SEQUENCE DER element. It must start with a DER
                                    SEQUENCE 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.

                DER INTEGERs are decoded into Python integers. Any other DER
                element is not decoded. Its validity is not checked.

                Raises a ValueError exception if the DER element is not a
                valid DER SEQUENCE.
                Raises an IndexError exception if the DER element is too short.
                rzNot a DER SEQUENCE.rrNrzNot a valid DER SEQUENCE.)r:rr2rrr*rrr)rrGr8r-r/)	rr0r1r9r+rZ
newIntegerZitemLenZitemIdxrrr r2�s$zDerSequence.decode)N)r)r3r4r5r6r!r<r=r?rBrCrErFrGrKrLr(r2rrrr r	�s
c@s&eZdZed�fdd�Zddd�ZdS)	rrcCst�|d�||_dS)NzOCTET STRING)rr!r)rr8rrr r!�szDerOctetString.__init__rcCs"t�||�}|�d�std��|S)NzOCTET STRINGzNot a valid OCTET STRING.)rr2r"r*)rr0r1�prrr r2s
zDerOctetString.decodeN)r)r3r4r5r7r!r2rrrr r�sc@seZdZdd�ZdS)rcCst�|d�dS)Nr)rr!)rrrr r!
szDerNull.__init__N)r3r4r5r!rrrr r	sc@seZdZdd�Zddd�ZdS)r
cCst�|d�dS)NzOBJECT IDENTIFIER)rr!)rrrr r!szDerObjectId.__init__rcCs"t�||�}|�d�std��|S)NzOBJECT IDENTIFIERzNot a valid OBJECT IDENTIFIER.)rr2r"r*)rr0r1rMrrr r2s
zDerObjectId.decodeN)r)r3r4r5r!r2rrrr r

scCs*d}y||7}Wntk
r$dSXdS)Nrr)�	TypeError)�xZtestrrr rsr)
ZCrypto.Util.numberrr�sysZCrypto.Util.py3compat�__all__rrr	rrr
rrrrr �<module>sS'g

Youez - 2016 - github.com/yon3zu
LinuXploit