403Webshell
Server IP : 192.158.238.246  /  Your IP : 3.133.87.185
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 :  /usr/lib/python3.6/site-packages/asn1crypto/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python3.6/site-packages/asn1crypto/__pycache__/parser.cpython-36.opt-1.pyc
3

y��Y�#�@s�dZddlmZmZmZmZddlZddlmZm	Z	m
Z
ddlmZm
Z
ejdkZdZd	d
�Zddd
�Zdd�Zddd�Zdd�ZdS)z�
Functions for parsing and dumping using the ASN.1 DER encoding. Exports the
following items:

 - emit()
 - parse()
 - peek()

Other type classes are defined that help compose the types listed above.
�)�unicode_literals�division�absolute_import�print_functionN�)�byte_cls�chr_cls�	type_name)�int_from_bytes�int_to_bytes�z<Insufficient data - %s bytes requested but only %s availablecCs�t|t�stdt|���|dks*|dkr6td|��t|t�sPtdt|���|dks`|dkrltd|��t|t�s�tdt|���|dkr�td	|��t|t�s�td
t|���t||||�|S)a�
    Constructs a byte string of an ASN.1 DER-encoded value

    This is typically not useful. Instead, use one of the standard classes from
    asn1crypto.core, or construct a new class with specific fields, and call the
    .dump() method.

    :param class_:
        An integer ASN.1 class value: 0 (universal), 1 (application),
        2 (context), 3 (private)

    :param method:
        An integer ASN.1 method value: 0 (primitive), 1 (constructed)

    :param tag:
        An integer ASN.1 tag value

    :param contents:
        A byte string of the encoded byte contents

    :return:
        A byte string of the ASN.1 DER value (header and contents)
    z!class_ must be an integer, not %srrz*class_ must be one of 0, 1, 2 or 3, not %sz!method must be an integer, not %srzmethod must be 0 or 1, not %sztag must be an integer, not %sz%tag must be greater than zero, not %sz&contents must be a byte string, not %s)�
isinstance�int�	TypeErrorr	�
ValueErrorr�_dump_header)�class_�method�tag�contents�r�/usr/lib/python3.6/parser.py�emits



rFcCsPt|t�stdt|���t|�}t||�\}}|rL||krLtd||��|S)al
    Parses a byte string of ASN.1 BER/DER-encoded data.

    This is typically not useful. Instead, use one of the standard classes from
    asn1crypto.core, or construct a new class with specific fields, and call the
    .load() class method.

    :param contents:
        A byte string of BER/DER-encoded data

    :param strict:
        A boolean indicating if trailing data should be forbidden - if so, a
        ValueError will be raised when trailing data exists

    :raises:
        ValueError - when the contents do not contain an ASN.1 header or are truncated in some way
        TypeError - when contents is not a byte string

    :return:
        A 6-element tuple:
         - 0: integer class (0 to 3)
         - 1: integer method
         - 2: integer tag
         - 3: byte string header
         - 4: byte string content
         - 5: byte string trailer
    z&contents must be a byte string, not %sz4Extra data - %d bytes of trailing data were provided)r
rrr	�len�_parser)r�strictZcontents_len�info�consumedrrr�parseJs
rcCs0t|t�stdt|���t|t|��\}}|S)aW
    Parses a byte string of ASN.1 BER/DER-encoded data to find the length

    This is typically used to look into an encoded value to see how long the
    next chunk of ASN.1-encoded data is. Primarily it is useful when a
    value is a concatenation of multiple values.

    :param contents:
        A byte string of BER/DER-encoded data

    :raises:
        ValueError - when the contents do not contain an ASN.1 header or are truncated in some way
        TypeError - when contents is not a byte string

    :return:
        An integer with the number of bytes occupied by the ASN.1 value
    z&contents must be a byte string, not %s)r
rrr	rr)rrrrrr�peekqs
rcCs4||dkr ttd||f��|}tr4t||�n||}|d7}|d@}|dkr�d}xFtrjt||�n||}|d7}|d9}||d@7}|d?dkrZPqZWtr�t||�n||}|d7}|d?dkr�|r�|||d@fS||d@}	n�|d@}
|
�r0||
7}|t|||
|�dd	�}	|�r�||	fSn�|}	|d
k�rF|	d7}	xF|	|k�r�t|||	dd�\}}	|	|k�rH||	d|	�d
k�rHP�qHW|�r�||	fS|	|k�r�tt|	|f��|d?|d?d@||||�|||	d�d
f|	fS|	|k�rtt|	|f��|d?|d?d@||||�|||	�df|	fS)a�
    Parses a byte string into component parts

    :param encoded_data:
        A byte string that contains BER-encoded data

    :param data_len:
        The integer length of the encoded data

    :param pointer:
        The index in the byte string to parse from

    :param lengths_only:
        A boolean to cause the call to return a 2-element tuple of the integer
        number of bytes in the header and the integer number of bytes in the
        contents. Internal use only.

    :return:
        A 2-element tuple:
         - 0: A tuple of (class_, method, tag, header, content, trailer)
         - 1: An integer indicating how many bytes were consumed
    �r�r���F)ZsignedrT)�lengths_onlys���)r�_INSUFFICIENT_DATA_MESSAGE�_PY2�ordr
r)Zencoded_dataZdata_lenZpointerr%�startZfirst_octetrZnumZlength_octetZcontents_endZ
length_octetsZsub_header_endrrrr�sl

 






rc	Cs�d}d}||d>O}||d>O}|dkrt|t|dB�7}xJ|dkrp|dkrNdnd}|t||d@B�7}|d?}q:Wn|t||B�7}t|�}|dkr�|t|�7}n$t|�}|tdt|�B�7}||7}|S)	a�
    Constructs the header bytes for an ASN.1 object

    :param class_:
        An integer ASN.1 class value: 0 (universal), 1 (application),
        2 (context), 3 (private)

    :param method:
        An integer ASN.1 method value: 0 (primitive), 1 (constructed)

    :param tag:
        An integer ASN.1 tag value

    :param contents:
        A byte string of the encoded byte contents

    :return:
        A byte string of the ASN.1 DER header
    r(rr&r'r!r#r"r$)rrr)	rrrr�headerZid_numZcontinuation_bitZlengthZlength_bytesrrrr�s$
r)r)F)rF)�__doc__Z
__future__rrrr�sysZ_typesrrr	�utilr
r�version_infor*r)rrrrrrrrr�<module>s
1
'
j

Youez - 2016 - github.com/yon3zu
LinuXploit