%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/paramiko/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/paramiko/__pycache__/rsakey.cpython-312.pyc

�

�ec����dZddlmZmZddlmZddlmZmZddl	m
Z
mZddlm
Z
ddlmZddlmZdd	lmZGd
�de�Zy)
z
RSA keys.
�)�InvalidSignature�UnsupportedAlgorithm)�default_backend)�hashes�
serialization)�rsa�padding)�Message)�PKey)�PY2)�SSHExceptionc�>�eZdZdZej
ej
ejejejejd�Z						dd�Z	e
d��Ze
d��Zd�Z
d�Ze
d	��Zd
�Zd�Zd�Zdd
�Zd�Zdd�Zdd�Zedd��Zd�Zd�Zd�Zy)�RSAKeyzZ
    Representation of an RSA key which can be used to sign and verify SSH2
    data.
    )�ssh-rsa�ssh-rsa-cert-v01@openssh.comzrsa-sha2-256z!rsa-sha2-256-cert-v01@openssh.comzrsa-sha2-512z!rsa-sha2-512-cert-v01@openssh.comNc�l�d|_d|_|�|j||�y|�|j||�y|�
|�t	|�}|�||_y|j|dd��t
j|j�|j���jt��|_y)Nrr)�msg�key_type�	cert_type��e�n)�key�public_blob�_from_private_key�_from_private_key_filer
�_check_type_and_load_certr�RSAPublicNumbers�	get_mpint�
public_keyr)�selfr�data�filename�passwordr�file_objs       �1/usr/lib/python3/dist-packages/paramiko/rsakey.py�__init__zRSAKey.__init__1s������������"�"�8�X�6�����'�'��(�;���K�d�.��$�-�C��?��D�H��*�*��#�8�
+�
��+�+��-�-�/�S�]�]�_���j��*�+�
�H�c�.�|jjS�N)r�key_size�r!s r&�sizezRSAKey.sizeRs���x�x� � � r(c���t|jtj�r$|jj	�j
S|jj�Sr*)�
isinstancerr�
RSAPrivateKey�private_numbers�public_numbersr,s r&r2zRSAKey.public_numbersVsB���d�h�h�� 1� 1�2��8�8�+�+�-�<�<�<��8�8�*�*�,�,r(c���t�}|jd�|j|jj�|j|jj
�|j
�S�Nr)r
�
add_string�	add_mpintr2rr�asbytes)r!�ms  r&r7zRSAKey.asbytes]sQ���I��	���Y��	���D�'�'�)�)�*�	���D�'�'�)�)�*��y�y�{�r(c�p�tr|j�S|j�jdd��S)N�utf8�ignore)�errors)rr7�decoder,s r&�__str__zRSAKey.__str__ds1��
��<�<�>�!��<�<�>�(�(���(�A�Ar(c�x�|j�|jj|jjfSr*)�get_namer2rrr,s r&�_fieldszRSAKey._fieldsps-���
�
���!4�!4�!6�!6��8K�8K�8M�8M�N�Nr(c��yr4�r,s r&r@zRSAKey.get_namets��r(c��|jSr*)r-r,s r&�get_bitszRSAKey.get_bitsws���y�y�r(c�J�t|jtj�Sr*)r/rrr0r,s r&�can_signzRSAKey.can_signzs���$�(�(�C�$5�$5�6�6r(c��|jj|tj�|j|���}t�}|j
|jdd��|j
|�|S)N)r	�	algorithmz-cert-v01@openssh.com�)r�signr	�PKCS1v15�HASHESr
r5�replace)r!r"rI�sigr8s     r&�
sign_ssh_datazRSAKey.sign_ssh_data}sm���h�h�m�m���$�$�&�,�d�k�k�)�,�.��
��

�I��	���Y�&�&�'>��C�D�	���S���r(c��|j�}||jvry|j}t|tj
�r|j
�}|j�}|jt|�dzz
}|dkDrd|dzdzz|z}	|j||tj�|j|��y#t$rYywxYw)NF�r��T)�get_textrMrr/rr0r �
get_binaryr+�len�verifyr	rLr)r!r"r�
sig_algorithmrrK�diffs       r&�verify_ssh_sigzRSAKey.verify_ssh_sig�s�������
�����+���h�h���c�3�,�,�-��.�.�"�C��~�~����|�|�c�$�i�!�m�+���!�8��t�a�x�A�o�.��5�D�	��J�J��d�G�,�,�.�0J����M�0J�0L�
��� �	��	�s�8C�	C�Cc�r�|j||jtjj|��y�N)r$)�_write_private_key_filerr�
PrivateFormat�TraditionalOpenSSL)r!r#r$s   r&�write_private_key_filezRSAKey.write_private_key_file�s1���$�$���H�H��'�'�:�:��		%�	
r(c�r�|j||jtjj|��yr])�_write_private_keyrrr_r`)r!r%r$s   r&�write_private_keyzRSAKey.write_private_key�s1�������H�H��'�'�:�:��		 �	
r(c�Z�tjd|t���}t|��S)a$
        Generate a new private RSA key.  This factory function can be used to
        generate a new host key or authentication key.

        :param int bits: number of bits the generated key should be.
        :param progress_func: Unused
        :return: new `.RSAKey` private key
        i)�public_exponentr+�backend)r)r�generate_private_keyrr)�bits�
progress_funcrs   r&�generatezRSAKey.generate�s*���&�&�!�D�/�:K�
���#��r(c�L�|jd||�}|j|�y�N�RSA)�_read_private_key_file�_decode_key)r!r#r$r"s    r&rzRSAKey._from_private_key_file�s$���*�*�5�(�H�E������r(c�L�|jd||�}|j|�yrm)�_read_private_keyrp)r!r%r$r"s    r&rzRSAKey._from_private_key�s$���%�%�e�X�x�@������r(c	�6�|\}}||jk(r"	tj|dt���}n�||jk(rp|j|d�\}}}}}}	tj||��}
tj||	|||dz
z||	dz
z||
��jt��}n|j|�t!tj"�sJ�||_y#tt
tf$r}tt|���d}~wwxYw)N)r$rg�iiiiiir�)�p�q�d�dmp1�dmq1�iqmpr2)�_PRIVATE_KEY_FORMAT_ORIGINALr�load_der_private_keyr�
ValueError�	TypeErrorrr
�str�_PRIVATE_KEY_FORMAT_OPENSSH�_uint32_cstruct_unpackrr�RSAPrivateNumbers�private_key�_got_bad_key_format_idr/r0r)r!r"�pkformatrrrrxr{rvrwr2s           r&rpzRSAKey._decode_key�s�����$��t�8�8�8�
+�#�8�8��4��1B���
��9�9�
9�"&�"=�"=�d�H�"M��A�q�!�T�1�a� �1�1�A��;�N��'�'�����!�a�%�[��!�a�%�[��-���k�/�+�,�
�
�'�'��1��#�s�0�0�1�1�1�����#�	�+?�@�
+�"�3�q�6�*�*��
+�s� C+�+D�?D�D)NNNNNN)rr*)�__name__�
__module__�__qualname__�__doc__r�SHA1�SHA256�SHA512rMr'�propertyr-r2r7r>rAr@rErGrPr[rard�staticmethodrkrrrprCr(r&rr"s�����;�;�(.����
�
�-3�]�]��
�
�-3�]�]�
�F�
�
�����,�B�!��!��-��-��
B��O��O���7�	��0
�
����� ��r(rN)r��cryptography.exceptionsrr�cryptography.hazmat.backendsr�cryptography.hazmat.primitivesrr�)cryptography.hazmat.primitives.asymmetricrr	�paramiko.messager
�
paramiko.pkeyr�paramiko.py3compatr�paramiko.ssh_exceptionr
rrCr(r&�<module>r�s3��&�K�8�@�B�$��"�/��T�r(

Zerion Mini Shell 1.0