%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__/dsskey.cpython-312.pyc

�

�ec ���dZddlmZddlmZddlmZmZddlm	Z	ddl
mZmZddl
mZddlmZdd	lmZdd
lmZddlmZmZddlmZGd
�de�Zy)z
DSS keys.
�)�InvalidSignature)�default_backend)�hashes�
serialization)�dsa)�decode_dss_signature�encode_dss_signature)�util)�	zero_byte)�SSHException)�Message)�BER�BERException)�PKeyc��eZdZdZ						dd�Zd�Zd�Zed��Zd�Z	d�Z
d	�Zdd
�Zd�Z
dd�Zdd
�Zedd��Zd�Zd�Zd�Zy)�DSSKeyzX
    Representation of a DSS key which can be used to sign an verify SSH2
    data.
    Nc��d|_d|_d|_d|_d|_d|_|�|j
||�y|�|j||�y|�
|�t|�}|�|\|_|_|_|_nh|j|dd��|j�|_|j�|_|j�|_|j�|_tj|j�|_
y)N�ssh-dsszssh-dss-cert-v01@openssh.com)�msg�key_type�	cert_type)�p�q�g�y�x�public_blob�_from_private_key�_from_private_key_filer
�_check_type_and_load_cert�	get_mpintr
�
bit_length�size)�selfr�data�filename�password�vals�file_objs       �1/usr/lib/python3/dist-packages/paramiko/dsskey.py�__init__zDSSKey.__init__.s������������������������"�"�8�X�6�����'�'��(�;���K�d�.��$�-�C���-1�*�D�F�D�F�D�F�D�F��*�*��"�8�
+�
�
�]�]�_�D�F��]�]�_�D�F��]�]�_�D�F��]�]�_�D�F��O�O�D�F�F�+��	�c�0�t�}|jd�|j|j�|j|j�|j|j
�|j|j�|j�S�Nr)r
�
add_string�	add_mpintrrrr�asbytes)r$�ms  r*r1zDSSKey.asbytesSsa���I��	���Y��	���D�F�F��	���D�F�F��	���D�F�F��	���D�F�F���y�y�{�r,c�"�|j�S�N)r1�r$s r*�__str__zDSSKey.__str__\s���|�|�~�r,c�|�|j�|j|j|j|jfSr4)�get_namerrrrr5s r*�_fieldszDSSKey._fields_s)���
�
��������������@�@r,c��yr.�r5s r*r8zDSSKey.get_namecs��r,c��|jSr4)r#r5s r*�get_bitszDSSKey.get_bitsfs���y�y�r,c��|jduSr4)rr5s r*�can_signzDSSKey.can_signis���v�v�T�!�!r,c���tj|jtj|jtj
|j|j|j������jt���}|j|tj��}t|�\}}t�}|j!d�t#j$|d�}t#j$|d�}	t'|�dkrt(dt'|�z
z|z}t'|	�dkrt(dt'|	�z
z|	z}	|j!||	z�|S)N�rrr�r�parameter_numbers�r�public_numbers��backendrr�)r�DSAPrivateNumbersr�DSAPublicNumbersr�DSAParameterNumbersrrr�private_keyr�signr�SHA1rr
r/r
�deflate_long�lenr)
r$r%�	algorithm�key�sig�r�sr2�rstr�sstrs
          r*�
sign_ssh_datazDSSKey.sign_ssh_datals���#�#��f�f��/�/��&�&�"%�"9�"9��f�f����$�&�&�#��
��+�o�/�+�
0�	��h�h�t�V�[�[�]�+��#�C�(���1��I��	���Y��� � ��A�&��� � ��A�&���t�9�r�>���S��Y��/�$�6�D��t�9�r�>���S��Y��/�$�6�D�	���T�D�[�!��r,c�j�t|j��dk(r|j�}n&|j�}|dk7ry|j�}t	j
|ddd�}t	j
|ddd�}t
||�}tj|jtj|j|j|j����jt���}	|j!||t#j$��y	#t&$rYy
wxYw)N�(rrrH�rArBrFTF)rPr1�get_text�
get_binaryr
�inflate_longr	rrJrrKrrr�
public_keyr�verifyrrNr)	r$r%rrS�kind�sigR�sigS�	signaturerRs	         r*�verify_ssh_sigzDSSKey.verify_ssh_sig�s���s�{�{�}���#��+�+�-�C��<�<�>�D��y� ���.�.�"�C�� � ��S�b��1�-��� � ��R�S��1�-��(��t�4�	��"�"��f�f�!�5�5��&�&�D�F�F�d�f�f��
�
�*�_�.�*�
/�	�	��J�J�y�$����
�6��� �	��	�s�%D&�&	D2�1D2c�v�tj|jtj|jtj
|j|j|j������jt���}|j||tjj|��y�NrArBrDrF)r')rrIrrJrrKrrrrLr�_write_private_key_filer�
PrivateFormat�TraditionalOpenSSL)r$r&r'rRs    r*�write_private_key_filezDSSKey.write_private_key_file�s����#�#��f�f��/�/��&�&�"%�"9�"9��f�f����$�&�&�#��
��+�o�/�+�
0�	�	
�$�$����'�'�:�:��		%�	
r,c�v�tj|jtj|jtj
|j|j|j������jt���}|j||tjj|��yrg)rrIrrJrrKrrrrLr�_write_private_keyrrirj)r$r)r'rRs    r*�write_private_keyzDSSKey.write_private_key�s����#�#��f�f��/�/��&�&�"%�"9�"9��f�f����$�&�&�#��
��+�o�/�+�
0�	�	
������'�'�:�:��		 �	
r,c�~�tj|t���j�}t	|j
jj|j
jj|j
jj|j
jf��}|j|_|S)a$
        Generate a new private DSS 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 `.DSSKey` private key
        rF)r()r�generate_private_keyr�private_numbersrrErCrrrrr)�bits�
progress_func�numbersrRs    r*�generatezDSSKey.generate�s����*�*��/�+�
�
�/�
�	���&�&�8�8�:�:��&�&�8�8�:�:��&�&�8�8�:�:��&�&�(�(�	�
���	�	����
r,c�L�|jd||�}|j|�y�N�DSA)�_read_private_key_file�_decode_key)r$r&r'r%s    r*rzDSSKey._from_private_key_file�s$���*�*�5�(�H�E������r,c�L�|jd||�}|j|�yrw)�_read_private_keyrz)r$r)r'r%s    r*rzDSSKey._from_private_key�s$���%�%�e�X�x�@������r,c�L�|\}}||jk(r	t|�j�}nB||jk(r"|j|d�}dgt|�z}n|j|�t�tust|�dks|ddk7rt	d��|d|_|d|_
|d|_|d	|_|d
|_t#j$|j�|_y#t$r}t	dj|���d}~wwxYw)NzUnable to parse key file: {}�iiiiir�z3not a valid DSA private key file (bad ber encoding)r[����)�_PRIVATE_KEY_FORMAT_ORIGINALr�decoderr�format�_PRIVATE_KEY_FORMAT_OPENSSH�_uint32_cstruct_unpack�list�_got_bad_key_format_id�typerPrrrrrr
r"r#)r$r%�pkformat�keylist�es     r*rzzDSSKey._decode_key�s�����$��t�8�8�8�
M��d�)�*�*�,����9�9�
9��1�1�$��@�G��c�D��M�)�G��'�'��1���=��$��G��q�(8�G�A�J�!�O��E��
���������������������������O�O�D�F�F�+��	��! �
M�"�#A�#H�#H��#K�L�L��
M�s�C;�;	D#�D�D#)NNNNNNr4)iN)�__name__�
__module__�__qualname__�__doc__r+r1r6�propertyr9r8r=r?rXrerkrn�staticmethodrurrrzr;r,r*rr(s����
�
���
��#,�J���A��A���"��2�:
�$
�$����2��,r,rN)r��cryptography.exceptionsr�cryptography.hazmat.backendsr�cryptography.hazmat.primitivesrr�)cryptography.hazmat.primitives.asymmetricr�/cryptography.hazmat.primitives.asymmetric.utilsrr	�paramikor
�paramiko.commonr�paramiko.ssh_exceptionr�paramiko.messager
�paramiko.berrr�
paramiko.pkeyrrr;r,r*�<module>r�s?��&�5�8�@�9��
�%�/�$�*��W,�T�W,r,

Zerion Mini Shell 1.0