⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.197
Server IP:
97.74.87.16
Server:
Linux 16.87.74.97.host.secureserver.net 5.14.0-503.38.1.el9_5.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Apr 18 08:52:10 EDT 2025 x86_64
Server Software:
Apache
PHP Version:
8.2.28
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
var
/
opt
/
nydus
/
ops
/
oscrypto
/
__pycache__
/
View File Name :
_pkcs1.cpython-39.pyc
a ������Ih]O����������������������@���s2��d�dl�mZmZmZmZ�d�dlZd�dlZd�dlZd�dlZd�dl Z d�dl Z ddlmZ�ddl mZmZ�ddlmZmZmZmZmZ�ddlmZ�ddlmZ�dd lmZmZmZ�ejd k�r�eZ e!Z"ndd��Z e��Z#g�d �Z$dd��Z%dd��Z&dd��Z'dd��Z(dd��Z)dd��Z*dd��Z+dd��Z,dd��Z-d d!��Z.d"d#��Z/dS�)$�����)�unicode_literals�division�absolute_import�print_functionN����)�backend)�constant_compare� rand_bytes)�Certificate�int_from_bytes�int_to_bytes�PrivateKeyInfo� PublicKeyInfo)�pretty_message)� fill_width)� type_name�byte_cls� int_types)����c�����������������C���s ���t�|�g�S�)N)�bytes)�num��r����@/opt/nydus/tmp/pip-target-os3qdbx0/lib/python/oscrypto/_pkcs1.py�chr_cls���s����r���)�add_pss_padding�add_pkcs1v15_signature_padding�raw_rsa_private_crypt�raw_rsa_public_crypt�"remove_pkcs1v15_encryption_padding�!remove_pkcs1v15_signature_padding�verify_pss_paddingc������������������C���s:���t�jdkrdS�t���d�}�ttt|��d���dd��dkS�)zM :return: A bool if the current machine is running OS X 10.7 �darwinFr����.����)� �������)�sys�platform�mac_ver�tuple�map�int�split)�versionr���r���r����_is_osx_107/���s���� r.���c�����������������C���s ��t�dkrtjdkrttd���t|t�s:ttdt|����t|t �sVttdt|����|dk�rpt tdt|����t|t �s�ttdt|����|d k�r�t td t|����|�tg�d��vr�t tdt|�����t t|��}|d �}tt�|d���}||����}t|�}|||�d�k��rt td���|dk�r4t�|�} nd} d|�| �} || ����}d||�|�d��}|d�| �} t|�|||�d ��}tt| �t|�A��}t|t|��}d|�|�}d|�dd|���}t|d�}|dk�r�t|t|dd ���@��|d d���}||�d�S�)a5�� Pads a byte string using the EMSA-PSS-Encode operation described in PKCS#1 v2.2. :param hash_algorithm: The string name of the hash algorithm to use: "sha1", "sha224", "sha256", "sha384", "sha512" :param salt_length: The length of the salt as an integer - typically the same as the length of the output from the hash_algorithm :param key_length: The length of the RSA key, in bits :param message: A byte string of the message to pad :return: The encoded (passed) message � winlegacyr!���z~ Pure-python RSA PSS signature padding addition code is only for Windows XP/2003 and OS X �? message must be a byte string, not %s �@ salt_length must be an integer, not %s r����? salt_length must be 0 or more - is %s �? key_length must be an integer, not %s i���z@ key_length must be 512 or more - is %s ��sha1�sha224�sha256�sha384�sha512�z hash_algorithm must be one of "sha1", "sha224", "sha256", "sha384", "sha512", not %s r�������r#���zq Key is not long enough to use with specified hash_algorithm and salt_length ���������������������������0�1����N�����)�_backendr&���r'����SystemErrorr���� isinstancer���� TypeErrorr���r���� ValueError�repr�set�getattr�hashlibr+����math�ceil�digest�len�os�urandom�_mgf1r���r���r���r����ord)�hash_algorithm�salt_length� key_length�message� hash_func�em_bits�em_len�message_digest�hash_length�salt�m_prime�m_prime_digest�padding�db�db_mask� masked_db� zero_bits� left_bit_mask� left_int_maskr���r���r���r���;���sv����� � �� ��� � $r���c�����������������C���s���t�dkrtjdkrttd���t|t�s:ttdt|����t|t�sVttdt|����t|t �srttdt|����|dk�r�t tdt|����|�tg�d ��vr�t td t|�����t t|��}|d�}tt�|d���}||����}t|�} || |�d �k�r�dS�|dd��dk�rdS�d|�|�} || �d�}|d|��}t|dd���} | d| �?�}|dk�r^dS�|||| ���}t|�||| �d��}d| �dd| ���}t|d �}|dk�r�t|t|dd���@��|dd���}tt|�t|�A��}t|�t|�k��rdt|�t|���|�}|| �|�d �}d|�}t|d|��|��s<dS�|||d���dk�rVdS�|d|�d��}d|�|�}||����}t||�S�)aZ�� Verifies the PSS padding on an encoded message :param hash_algorithm: The string name of the hash algorithm to use: "sha1", "sha224", "sha256", "sha384", "sha512" :param salt_length: The length of the salt as an integer - typically the same as the length of the output from the hash_algorithm :param key_length: The length of the RSA key, in bits :param message: A byte string of the message to pad :param signature: The signature to verify :return: A boolean indicating if the signature is invalid r/���r!���z� Pure-python RSA PSS signature padding verification code is only for Windows XP/2003 and OS X r0���zA signature must be a byte string, not %s r1���r���r2���r4���r:���r���r;���r#���F���NrC���r@���rA���rB���r>���r?���r=���)rD���r&���r'���rE���r���rF���r���rG���r���r���rH���rI���rJ���rK���rL���r+���rM���rN���rO���rP���rT���rS���r���r���r���r���)rU���rV���rW���rX���� signaturerY���rZ���r[���r\���r]���re���Zmasked_db_lengthrd���Z first_byteZbits_that_should_be_zeror`���rc���rf���rg���rb���Zzero_lengthZzero_stringr^���r_���Zh_primer���r���r���r �������s������ � � ��� $r ���c����������� ������C���s����t�|t�sttdt|����t�|t�s8ttdt|����|dk�rRttdt|����|�tg�d��vrtttdt|�����d}dd d ddd�|��}t t �||���}t� d �j}tt|��}td|�D�] }||�} |||| �����7�}q�|d|��S�)a|�� The PKCS#1 MGF1 mask generation algorithm :param hash_algorithm: The string name of the hash algorithm to use: "sha1", "sha224", "sha256", "sha384", "sha512" :param seed: A byte string to use as the seed for the mask :param mask_length: The desired mask length, as an integer :return: A byte string of the mask z< seed must be a byte string, not %s z@ mask_length must be an integer, not %s r���zD mask_length must be greater than 0 - is %s r4���r:���r<������������ ����0����@���s���>Ir���)rF���r���rG���r���r���r���rH���rI���rJ���r+���rM���rN����struct�Struct�packrK���rL����rangerO���) rU����seedZmask_length�outputr]���Z iterationsrq���rY����counter�br���r���r���rS���:��sH���� � ����� rS���c�����������������C���s ���t�dkrttd���t|�|d�S�)z� Adds PKCS#1 v1.5 padding to a message to be signed :param key_length: An integer of the number of bytes in the key :param data: A byte string to pad :return: The padded data as a byte string r/���zz Pure-python RSA PKCSv1.5 signature padding addition code is only for Windows XP/2003 Zsigning)rD���rE���r����_add_pkcs1v15_padding�rW����datar���r���r���r������s �����r���c�����������������C���s ���t�dkrttd���t|�|d�S�)a�� Removes PKCS#1 v1.5 padding from a signed message using constant time operations :param key_length: An integer of the number of bytes in the key :param data: A byte string to unpad :return: The unpadded data as a byte string r/���zy Pure-python RSA PKCSv1.5 signature padding removal code is only for Windows XP/2003 Z verifying)rD���rE���r����_remove_pkcs1v15_paddingrx���r���r���r���r������s �����r���c�����������������C���s���t���sttd���t|�|d�S�)a�� Removes PKCS#1 v1.5 padding from a decrypted message using constant time operations :param key_length: An integer of the number of bytes in the key :param data: A byte string to unpad :return: The unpadded data as a byte string zt Pure-python RSA PKCSv1.5 encryption padding removal code is only for OS X 10.7 � decrypting)r.���rE���r���rz���rx���r���r���r���r������s �����r���c�����������������C���s����|dkrd}nd}t�|t�s.ttdt|����t�|�t�sJttdt|�����|�dk�rdttdt|�����t|�|�d�kr�ttd |�d�t|����|�d �t|��}d}|dkr�t |�}d� |�d ��}||7�}|t|�8�}q�d |�|�d �|�S�)a1�� Adds PKCS#1 v1.5 padding to a message :param key_length: An integer of the number of bytes in the key :param data: A byte string to unpad :param operation: A unicode string of "encrypting" or "signing" :return: The padded data as a byte string Z encrypting����r?����< data must be a byte string, not %s r3���rn����? key_length must be 64 or more - is %s ����zJ data must be between 1 and %s bytes long - is %s r���r<���r���r>���)rF���r���rG���r���r���r���rH���rI���rP���r ����joinr,���)rW���ry���� operation�second_byteZrequired_bytesra���Ztemp_paddingr���r���r���rw������s@���� � ���rw���c�����������������C���sn��|dkrd}nd}t�|t�s.ttdt|����t�|�t�sJttdt|�����|�dk�rdttdt|�����t|�|�kr|td|���d }d }d }t d t|��D�]�}|||d���}t |�} |d kr�|| O�}q�|dkr�|t| |B�|k�O�}q�|d k��r|t| d A�d k�O�}q�| d B�} |d k�r.| �r$||O�}n||O�}q�| �r>||O�}q�||O�}q�|d k�r^td|���||d�d��S�)aY�� Removes PKCS#1 v1.5 padding from a message using constant time operations :param key_length: An integer of the number of bytes in the key :param data: A byte string to unpad :param operation: A unicode string of "decrypting" or "verifying" :return: The unpadded data as a byte string r{���r#���r���r}���r3���rn���r~���zError %sr���r$���N)rF���r���rG���r���r���r���rH���rI���rP���rr���rT���r+���)rW���ry���r����r�����errorZtrashZpadding_end�i�byteZbyte_numZnon_zeror���r���r���rz�����sV���� � �� rz���c�����������������C���s����t�dkrtd��t|�d�r&t|�jt�s8ttdt|�����|�jd�d�j }|dkrj|dkrjt td |������t|t�s�ttd t|����|�jd�j }tt|�|d�j |d �j �}t||�jjd�S�)aa�� Performs a raw RSA algorithm in a byte string using a private key. This is a low-level primitive and is prone to disastrous results if used incorrectly. :param private_key: An oscrypto.asymmetric.PrivateKey object :param data: A byte string of the plaintext to be signed or ciphertext to be decrypted. Must be less than or equal to the length of the private key. In the case of signing, padding must already be applied. In the case of decryption, padding must be removed afterward. :return: A byte string of the transformed data r/����1Pure-python RSA crypt is only for Windows XP/2003�asn1zy private_key must be an instance of the oscrypto.asymmetric.PrivateKey class, not %s Zprivate_key_algorithm� algorithm�rsa� rsassa_pssz@ private_key must be an RSA key, not %s r}����private_keyZprivate_exponent�modulus��width)rD���rE����hasattrrF���r����r ���rG���r���r����nativerH����upperr����parsed�powr���r���� byte_size)r����ry����algoZrsa_private_key�transformed_intr���r���r���r���n��s2������ ��r���c�����������������C���s����t�dkrtd��t|�d�}ttf}|r2t|�j|�sDttdt |�����|�jd�d�j }|dkrv|dkrvttd|������t|t �s�ttd t |����|�jd �j}tt|�|d�j |d�j �}t||�jjd �S�)a��� Performs a raw RSA algorithm in a byte string using a certificate or public key. This is a low-level primitive and is prone to disastrous results if used incorrectly. :param certificate_or_public_key: An oscrypto.asymmetric.PublicKey or oscrypto.asymmetric.Certificate object :param data: A byte string of the signature when verifying, or padded plaintext when encrypting. Must be less than or equal to the length of the public key. When verifying, padding will need to be removed afterwards. When encrypting, padding must be applied before. :return: A byte string of the transformed data r/���r����r����z� certificate_or_public_key must be an instance of the oscrypto.asymmetric.PublicKey or oscrypto.asymmetric.Certificate classes, not %s r����r����r����zN certificate_or_public_key must be an RSA key, not %s r}���Z public_keyZpublic_exponentr����r����)rD���rE���r����r���r ���rF���r����rG���r���r���r����rH���r����r���r����r����r���r���r����)Zcertificate_or_public_keyry���Zhas_asn1Zvalid_typesr����Zrsa_public_keyr����r���r���r���r������s<���� � � ���r���)0� __future__r���r���r���r���r&���rL���rM���r'���ro���rQ�����r����utilr���r ���Z_asn1r ���r���r���r ���r����_errorsr����_intr����_typesr���r���r����version_info�chrr����xrangerr���rD����__all__r.���r���r ���rS���r���r���r���rw���rz���r���r���r���r���r���r����<module>���s<��� ~�IC[9