HOME


Mini Shell 1.0
Redirecting to https://devs.lapieza.net/iniciar-sesion Redirecting to https://devs.lapieza.net/iniciar-sesion.
DIR: /proc/self/root/usr/lib/python3/dist-packages/josepy/__pycache__/
Upload File :
Current File : //proc/self/root/usr/lib/python3/dist-packages/josepy/__pycache__/util.cpython-311.pyc
�

*b'���dZddlZddlZddlZddlmZmZddlmZddl	m
Z
mZmZm
Z
mZmZmZmZddlmZmZddlmZded	efd
�ZGd�d��ZGd
�d��ZGd�de��ZGd�de��Zedd���ZGd�dee��ZGd�dee��ZGd�d��Z eee ej!e"����ej!e"<dS)zJOSE utilities.�N)�Hashable�Mapping)�
ModuleType)�Any�Callable�Iterator�List�Tuple�TypeVar�Union�cast)�ec�rsa)�crypto�func�returnc�D�ttj|����S�N)�classmethod�abc�abstractmethod)rs �-/usr/lib/python3/dist-packages/josepy/util.py�abstractclassmethodrs���s�)�$�/�/�0�0�0�c��eZdZdZdeejejfddfd�Zde	de
fd�Zejfde
defd	�Zd
e
defd�Zde
fd�Zde	fd
�ZdS)�ComparableX509z�Wrapper for OpenSSL.crypto.X509** objects that supports __eq__.

    :ivar wrapped: Wrapped certificate or certificate request.
    :type wrapped: `OpenSSL.crypto.X509` or `OpenSSL.crypto.X509Req`.

    �wrappedrNc��t|tj��st|tj��sJ�||_dSr)�
isinstancer�X509�X509Reqr��selfrs  r�__init__zComparableX509.__init__sC���'�6�;�/�/�	%�:��V�^�4%�4%�	%�	%�	%�����r�namec�,�t|j|��Sr)�getattrr�r#r%s  r�__getattr__zComparableX509.__getattr__s���t�|�T�*�*�*r�filetypec��t|jtj��rtj||j��Stj||j��S)aNDumps the object into a buffer with the specified encoding.

        :param int filetype: The desired encoding. Should be one of
            `OpenSSL.crypto.FILETYPE_ASN1`,
            `OpenSSL.crypto.FILETYPE_PEM`, or
            `OpenSSL.crypto.FILETYPE_TEXT`.

        :returns: Encoded X509 object.
        :rtype: bytes

        )rrrr �dump_certificate�dump_certificate_request)r#r*s  r�_dumpzComparableX509._dump"sG���d�l�F�K�0�0�	C��*�8�T�\�B�B�B��.�x���F�F�Fr�otherc��t||j��stS|���|���kSr)r�	__class__�NotImplementedr.�r#r/s  r�__eq__zComparableX509.__eq__4s7���%���0�0�	"�!�!��z�z�|�|�u�{�{�}�}�,�,rc�R�t|j|���f��Sr)�hashr1r.�r#s r�__hash__zComparableX509.__hash__9s���T�^�T�Z�Z�\�\�2�3�3�3rc�L�d�|jj|j��S�Nz<{0}({1!r})>)�formatr1�__name__rr7s r�__repr__zComparableX509.__repr__<s���$�$�T�^�%<�d�l�K�K�Kr)r<�
__module__�__qualname__�__doc__rrr r!r$�strrr)�
FILETYPE_ASN1�int�bytesr.�boolr4r8r=�rrrrs����������f�k�6�>�&A� B��t�����
+��+��+�+�+�+�%+�$8�G�G�c�G�U�G�G�G�G�$-�C�-�D�-�-�-�-�
4�#�4�4�4�4�L�#�L�L�L�L�L�Lrrc��eZdZUdZeZegefed<de	e
je
je
je
jffd�Zdedefd�Zdedefd	�Zdefd
�Zd
d�ZdS)�
ComparableKeyznComparable wrapper for ``cryptography`` keys.

    See https://github.com/pyca/cryptography/issues/2122.

    r8rc��||_dSr)�_wrappedr"s  rr$zComparableKey.__init__Hs�� ��
�
�
rr%rc�,�t|j|��Sr)r'rJr(s  rr)zComparableKey.__getattr__Ps���t�}�d�+�+�+rr/c�t�t||j��r|jj|jjurtSt	|jd��r*|���|���kSt	|jd��r*|���|���kStS)N�private_numbers�public_numbers)rr1rJr2�hasattrrMrNr3s  rr4zComparableKey.__eq__Ss����5�$�.�1�1�	"��
�'�u�~�/G�G�G�!�!�
�T�]�$5�
6�
6�	"��'�'�)�)�U�-B�-B�-D�-D�D�D�
�T�]�$4�
5�
5�	"��&�&�(�(�E�,@�,@�,B�,B�B�B�!�!rc�L�d�|jj|j��Sr:)r;r1r<rJr7s rr=zComparableKey.__repr__^s���$�$�T�^�%<�d�m�L�L�Lrc��t|jtjtjf��r|S|�|j�����S)zGet wrapped public key.)rrJr�RSAPublicKeyWithSerializationr�'EllipticCurvePublicKeyWithSerializationr1�
public_keyr7s rrTzComparableKey.public_keyasP���d�m�c�&G�&(�&P�&R�S�S�	��K��~�~�d�m�6�6�8�8�9�9�9rN)rrH)r<r>r?r@r2r8rrC�__annotations__rr�RSAPrivateKeyWithSerializationrRr�(EllipticCurvePrivateKeyWithSerializationrSr$rArr)rEr4r=rTrFrrrHrH@s����������
#1�H�h�r�3�w��0�0�0� ���7��6��@��?�@�A� � � � �,��,��,�,�,�,�	"�C�	"�D�	"�	"�	"�	"�M�#�M�M�M�M�:�:�:�:�:�:rrHc��eZdZdZdefd�ZdS)�ComparableRSAKeyz�Wrapper for ``cryptography`` RSA keys.

    Wraps around:

    - :class:`~cryptography.hazmat.primitives.asymmetric.rsa.RSAPrivateKey`
    - :class:`~cryptography.hazmat.primitives.asymmetric.rsa.RSAPublicKey`

    rc
��t|jtj��rZ|���}|j}t
|j|j|j	|j
|j|j|j
|jf��St|jtj��r5|���}t
|j|j
|jf��St!���r)rrJrrVrMrNr6r1�p�q�dmp1�dmq1�iqmp�n�erR�NotImplementedError�r#�priv�pubs   rr8zComparableRSAKey.__hash__ts����d�m�S�%G�H�H�	8��'�'�)�)�D��%�C������������D�I�s�u�c�e�=�>�>�
>�
��
�s�'H�
I�
I�	8��%�%�'�'�C��������6�7�7�7�!�#�#�#rN�r<r>r?r@rCr8rFrrrYrYjs9��������$�#�$�$�$�$�$�$rrYc��eZdZdZdefd�ZdS)�ComparableECKeyz�Wrapper for ``cryptography`` RSA keys.
    Wraps around:
    - :class:`~cryptography.hazmat.primitives.asymmetric.ec.EllipticCurvePrivateKey`
    - :class:`~cryptography.hazmat.primitives.asymmetric.ec.EllipticCurvePublicKey`
    rc��t|jtj��rM|���}|j}t
|j|jj	|j
|j|jf��St|jtj
��r@|���}t
|j|jj	|j
|jf��St���r)rrJrrWrMrNr6r1�curver%�x�y�
private_valuerSrbrcs   rr8zComparableECKey.__hash__�s����d�m�R�%P�Q�Q�	H��'�'�)�)�D��%�C�����������t�GY�Z�[�[�[�
��
�r�'Q�
R�
R�	H��%�%�'�'�C�����������F�G�G�G�!�#�#�#rNrfrFrrrhrh�s9��������$�#�$�$�$�$�$�$rrh�GenericImmutableMap�ImmutableMap)�boundc��eZdZUdZdZeedfed<	deddfd�Z	d	e
dede
fd
�Zdedefd�Zde
efd
�Zdefd�Zdefd�Zdededdfd�Zdefd�ZdS)roz5Immutable key to value mapping with attribute access.rF.�	__slots__�kwargsrNc�f�t|��t|j��krRtd�d�|j��|rd�|��nd�����|jD]1}t
�|||�|�����2dS)NzA__init__() takes exactly the following arguments: {0} ({1} given)�, �none)�setrr�	TypeErrorr;�join�object�__setattr__�pop)r#rs�slots   rr$zImmutableMap.__init__�s����v�;�;�#�d�n�-�-�-�-���$�f�T�Y�Y�t�~�%>�%>�:@�%L�T�Y�Y�v�%6�%6�%6�f�N�N�O�O�
O��N�	=�	=�D����t�T�6�:�:�d�+;�+;�<�<�<�<�	=�	=rr#c�8�i|�|�}t|��di|��S)zReturn updated map.rF)�type)r#rs�itemss   r�updatezImmutableMap.update�s-��#5�d�#5�f�#5���t�D�z�z�"�"�E�"�"�"r�keyc�^�	t||��S#t$rt|���wxYwr)r'�AttributeError�KeyError�r#r�s  r�__getitem__zImmutableMap.__getitem__�s>��	 ��4��%�%�%���	 �	 �	 ��3�-�-��	 ���s��,c�*�t|j��Sr)�iterrrr7s r�__iter__zImmutableMap.__iter__�s���D�N�#�#�#rc�*�t|j��Sr)�lenrrr7s r�__len__zImmutableMap.__len__�s���4�>�"�"�"rc�^��tt�fd��jD������S)Nc3�8�K�|]}t�|��V��dSr)r')�.0r}r#s  �r�	<genexpr>z(ImmutableMap.__hash__.<locals>.<genexpr>�s-�����I�I�$�'�$��-�-�I�I�I�I�I�Ir)r6�tuplerrr7s`rr8zImmutableMap.__hash__�s0����E�I�I�I�I�$�.�I�I�I�I�I�J�J�Jrr%�valuec� �td����Nzcan't set attribute�r��r#r%r�s   rr{zImmutableMap.__setattr__�����2�3�3�3rc��d�|jjd�d�|���D������S)Nz{0}({1})ruc3�HK�|]\}}d�||��V��dS�z	{0}={1!r}N�r;�r�r�r�s   rr�z(ImmutableMap.__repr__.<locals>.<genexpr>�sR����D,�D,���U�
���s�E�*�*�D,�D,�D,�D,�D,�D,r)r;r1r<ryr�r7s rr=zImmutableMap.__repr__�sZ��� � ���!8�$�)�)�D,�D,�"�j�j�l�l�D,�D,�D,�;,�;,�-�-�	-r)r<r>r?r@rrr
rArUrr$rnr�r�rr�rCr�r8r{r=rFrrroro�sD�������?�?�!#�I�u�S�#�X��#�#�#�+�=��=��=�=�=�=�#�(�#�C�#�<O�#�#�#�#�
 �s� �s� � � � �$�(�3�-�$�$�$�$�#��#�#�#�#�K�#�K�K�K�K�4��4�C�4�D�4�4�4�4�-�#�-�-�-�-�-�-rc���eZdZdZdZdededdfd�Zdedefd	�Zde	efd
�Z
defd�Zde
e
eefdffd
�Zdefd�Zdedefd�Zdededdfd�Zdefd�ZdS)�
frozendictzFrozen dictionary.)�_items�_keys�argsrsrNc
��|r|st|��}nEt|��dkr$t|dt��r	|d}nt	���t
�|d|��t
�|dtt|�	��������dS)N�rr�r�)
�dictr�rrrxrzr{r��sorted�keys)r#r�rsr�s    rr$zfrozendict.__init__�s����	�$�	���L�L�E�E�
��Y�Y�!�^�^�
�4��7�G� <� <�^���G�E�E��+�+��	���4��5�1�1�1����4��%��u�z�z�|�|�0D�0D�*E�*E�F�F�F�F�Frr�c��|j|Sr)r�r�s  rr�zfrozendict.__getitem__�s���{�3��rc�*�t|j��Sr)r�r�r7s rr�zfrozendict.__iter__�s���D�J���rc�*�t|j��Sr)r�r�r7s rr�zfrozendict.__len__�s���4�;���r.c�D��t�fd��jD����S)Nc3�,�K�|]}|�|fV��dSrrF)r�r�r#s  �rr�z+frozendict._sorted_items.<locals>.<genexpr>�s,�����<�<�#�c�4��9�%�<�<�<�<�<�<r)r�r�r7s`r�
_sorted_itemszfrozendict._sorted_items�s(����<�<�<�<���<�<�<�<�<�<rc�D�t|�����Sr)r6r�r7s rr8zfrozendict.__hash__�s���D�&�&�(�(�)�)�)rr%c�X�	|j|S#t$rt|���wxYwr)r�r�r�r(s  rr)zfrozendict.__getattr__�s=��	'��;�t�$�$���	'�	'�	'� ��&�&�&�	'���s��)r�c� �td���r�r�r�s   rr{zfrozendict.__setattr__�r�rc��d�d�d�|���D������S)Nzfrozendict({0})ruc3�HK�|]\}}d�||��V��dSr�r�r�s   rr�z&frozendict.__repr__.<locals>.<genexpr>�sW����2@�2@�&�C��3>�2D�2D���3�3�2@�2@�2@�2@�2@�2@r)r;ryr�r7s rr=zfrozendict.__repr__�s\�� �'�'��	�	�2@�2@�*.�*<�*<�*>�*>�2@�2@�2@�)@�)@�A�A�	Ar)r<r>r?r@rrrr$rAr�rr�rCr�r
r�r8r)r{r=rFrrr�r��s`��������#�I�G�c�G�S�G�T�G�G�G�G� �s� �s� � � � � �(�3�-� � � � � �� � � � �=�u�U�3��8�_�c�%9�:�=�=�=�=�*�#�*�*�*�*�'��'��'�'�'�'�4��4�C�4�D�4�4�4�4�A�#�A�A�A�A�A�Arr�c�n�eZdZdZdeddfd�Zdedefd�Zdededdfd	�Z	deddfd
�Z
deefd�ZdS)�_UtilDeprecationModulez�
    Internal class delegating to a module, and displaying warnings when attributes
    related to the deprecated "abstractclassmethod" attributes in the josepy.util module.
    �modulerNc��||jd<dS�N�_module)�__dict__)r#r�s  rr$z_UtilDeprecationModule.__init__�s��#)��
�i� � � r�attrc�p�|dkrtjdtd���t|j|��S)Nrz�The abstractclassmethod attribute in josepy.util is deprecated and will be removed soon. Please use the built-in decorators @classmethod and @abc.abstractmethod together instead.�)�
stacklevel)�warnings�warn�DeprecationWarningr'r��r#r�s  rr)z"_UtilDeprecationModule.__getattr__sH���(�(�(��M�B�-��
<�
<�
<�
<��t�|�T�*�*�*rr�c�2�t|j||��dSr)�setattrr�)r#r�r�s   rr{z"_UtilDeprecationModule.__setattr__s�����d�E�*�*�*�*�*rc�0�t|j|��dSr)�delattrr�r�s  r�__delattr__z"_UtilDeprecationModule.__delattr__s�����d�#�#�#�#�#rc�2�dgt|j��zSr�)�dirr�r7s r�__dir__z_UtilDeprecationModule.__dir__s���{�S���.�.�.�.r)
r<r>r?r@rr$rArr)r{r�r	r�rFrrr�r��s���������*�z�*�d�*�*�*�*�+��+��+�+�+�+�+��+�C�+�D�+�+�+�+�$��$��$�$�$�$�/��c��/�/�/�/�/�/rr�)#r@r�sysr��collections.abcrr�typesr�typingrrrr	r
rrr
�)cryptography.hazmat.primitives.asymmetricrr�OpenSSLrrrrrHrYrhrnror�r��modulesr<rFrr�<module>r�s[����
�
�
�
�
�
�
�
�����-�-�-�-�-�-�-�-�������M�M�M�M�M�M�M�M�M�M�M�M�M�M�M�M�M�M�M�M�=�=�=�=�=�=�=�=�������1�h�1�;�1�1�1�1�+L�+L�+L�+L�+L�+L�+L�+L�\':�':�':�':�':�':�':�':�T$�$�$�$�$�}�$�$�$�2$�$�$�$�$�m�$�$�$�*�g�3�>�J�J�J��)-�)-�)-�)-�)-�7�H�)-�)-�)-�X+A�+A�+A�+A�+A��(�+A�+A�+A�b/�/�/�/�/�/�/�/�6��Z�)?�)?���H�@U�)V�)V�W�W���H���r