CyberAlphaWolf

Server : Apache
System : Linux 182.49.167.72.host.secureserver.net 4.18.0-553.92.1.el8_10.x86_64 #1 SMP Wed Jan 14 06:31:58 EST 2026 x86_64
User : kikai ( 1014)
PHP Version : 8.3.30
Disable Function : NONE
Directory :  /var/opt/nydus/ops/asn1crypto/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //var/opt/nydus/ops/asn1crypto/__pycache__/parser.cpython-312.pyc
�

��i�#���dZddlmZmZmZmZddlZddlmZm	Z	m
Z
ddlmZm
Z
ejdkZdZd	Zd
�Zdd�Zd�Zdd
�Zd�Zy)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 available�
c���t|t�stdt|�z��|dks|dkDrt	d|z��t|t�stdt|�z��|dks|dkDrt	d|z��t|t�stdt|�z��|dkrt	d	|z��t|t
�std
t|�z��t
||||�|zS)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 %s�&contents must be a byte string, not %s)�
isinstance�int�	TypeErrorr
�
ValueErrorr�_dump_header)�class_�method�tag�contentss    �B/opt/nydus/tmp/pip-target-4r_833n3/lib/python/asn1crypto/parser.py�emitrs���2�f�c�"��;�i��>O�O�P�P�
��z�V�a�Z��E��N�O�O��f�c�"��;�i��>O�O�P�P�
��z�V�a�Z��8�6�A�B�B��c�3���8�9�S�>�I�J�J�
�Q�w��@�3�F�G�G��h��)��@�9�X�CV�V�W�W�����X�6��A�A�c��t|t�stdt|�z��t	|�}t||�\}}|r||k7rt
d||z
z��|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
    rz4Extra data - %d bytes of trailing data were provided)rrrr
�len�_parser)r�strict�contents_len�info�consumeds     r�parser$Ksd��:�h��)��@�9�X�CV�V�W�W��x�=�L��H�l�3�N�D�(�
�(�l�*��O�S_�bj�Sj�k�l�l��Krc��t|t�stdt|�z��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
    r)rrrr
rr)rr"r#s   r�peekr&rs=��&�h��)��@�9�X�CV�V�W�W��H�c�(�m�4�N�D�(��Orc
��|tkDrtd��|}||dzkrttd||z
fz��trt	||�n||}|dz
}|dz}|dz	dz}|dk(r|d}	||dzkrttd||z
fz��trt	||�n||}	|dz
}|	dk(r|dk(rtd��|dz}||	d	zz
}|	d
z	dk(rn�i|dkrtd��||dzkrttd||z
fz��trt	||�n||}
|dz
}d}|
d
z	dk(r	||
d	zz}n�|
d	z}
|
r;|||
zkrtt|
||z
fz��||
z
}|t|||
z
|d�
�z}nT|std��|}||dzks|||dzdk7r+t
|||d|dz��\}}||dzkr�|||dzdk7r�+|dz
}d}||kDrtt||z
||z
fz��|r||fS|dz	||||||||t|�z
|f|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.

    :param depth:
        The recursion depth when evaluating indefinite-length encoding.

    :return:
        A 2-element tuple:
         - 0: A tuple of (class_, method, tag, header, content, trailer)
         - 1: An integer indicating how many bytes were consumed
    z*Indefinite-length recursion limit exceededr��rT�zNon-minimal tag encoding��rF)�signedz-Indefinite-length element must be constructed�s)�lengths_only�depth�)�
_MAX_DEPTHr�_INSUFFICIENT_DATA_MESSAGE�_PY2�ordrrr)�encoded_data�data_len�pointerr/r0�start�first_octetr�constructed�num�length_octet�trailer�contents_end�
length_octets�_s               rrr�s���6
�z���E�F�F��E��'�A�+���3�q�(�W�:L�6M�M�N�N�04�#�l�7�+�,�,�w�:O�K��q�L�G�
��
�C��!�#�q�(�K�
�b�y�����'�A�+�%� �!;�q�(�W�BT�>U�!U�V�V�04�#�l�7�+�,�,�w�:O�C��q�L�G��d�{�s�a�x� �!;�<�<��3�J�C��3��9��C��a�x�1�}�����8��7�8�8��'�A�+���3�q�(�W�:L�6M�M�N�N�15�3�|�G�,�-�<��;P�L��q�L�G��G��q��A���,��"4�5��%�s�*�
���'�M�1�1� �!;�}�h�Y`�N`�>a�!a�b�b��}�$�G�"�^�L��=�AX�Y`�4a�jo�%p�p�L�� �!P�Q�Q�"�L��\�A�-�-��l�<�XY�>�1Z�^i�1i�"(��x��\`�hm�no�ho�"p���<��\�A�-�-��l�<�XY�>�1Z�^i�1i��A��L�!�G��h���3�|�g�7M�x�Za�Oa�6b�b�c�c����&�&�
�1������w�'����c�'�l�!:�;��
	
�	�
�
rc�f�d}d}||dzz}||dzz}|dk\r<d}|dkDr#t||dzz�|z}|sd}|dz	}|dkDr�#t|dz�|z}n|t||z�z
}t|�}|dkr|t|�z
}|St|�}|tdt|�z�z
}||z
}|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
    rrr1r)r(r+r*r,)r	rr)	rrrr�header�id_num�cont_bit�length�length_bytess	         rrr�s���*�F�
�F�
�f��k��F�
�f��k��F�
�b�y����A�g��X��t��4�5��>�F������(�C�	�A�g�
��"��%��.���'�&�3�,�'�'��
��]�F�
��}��'�&�/�!���M�	$�F�+���'�$��\�!2�2�3�3���,����Mr)F)rFr)�__doc__�
__future__rrrr�sys�_typesrr	r
�utilrr�version_infor4r3r2rr$r&rr�rr�<module>rOsX��	�S�R�
�0�0�.�
���4���[��
�
�.B�b$�N�4g�T.r

XYZEAZ - Cyber Alpha Wolf © All Rights Reserved