https://t.me/AnonymousX5
Server : Apache
System : Linux cvar2.toservers.com 3.10.0-962.3.2.lve1.5.73.el7.x86_64 #1 SMP Wed Aug 24 21:31:23 UTC 2022 x86_64
User : njnconst ( 1116)
PHP Version : 8.4.18
Disable Function : NONE
Directory :  /proc/self/root/usr/lib/python2.7/site-packages/paramiko/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //proc/self/root/usr/lib/python2.7/site-packages/paramiko/pkey.pyc
�
x�\c@sdZddlZddlmZddlZddlmZddlmZddl	m
Z
ddlmZm
Z
mZddlmZdd	lmZdd
lmZmZmZmZmZddlmZmZddlmZd
efd��YZdefd��YZ dS(s!
Common API for all public keys.
i����N(t	unhexlify(tmd5(tdefault_backend(t
serialization(t
algorithmstmodestCipher(tutil(to600(tutencodebytestdecodebytestbtstring_types(tSSHExceptiontPasswordRequiredException(tMessagetPKeycBseZdZiiejd6dd6dd6ejd6d6iejd6dd6dd6ejd6d6iejd6d	d6d
d6ejd6d6Zd"d"d�Z
d
�Zd�Zd�Z
d�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zed"d��Zed"d��Zd"d�Zd"d�Zd"d�Zd"d�Zd"d�Zd"d�Zd �Zd!�Z RS(#s%
    Base class for public keys.
    tcipheritkeysizet	blocksizetmodesAES-128-CBCi sAES-256-CBCiisDES-EDE3-CBCcCsdS(s[
        Create a new instance of this public key type.  If ``msg`` is given,
        the key's public part(s) will be filled in from the message.  If
        ``data`` is given, the key's public part(s) will be filled in from
        the string.

        :param .Message msg:
            an optional SSH `.Message` containing a public key of this type.
        :param str data: an optional string containing a public key
            of this type

        :raises: `.SSHException` --
            if a key cannot be created from the ``data`` or ``msg`` given, or
            no key was passed in.
        N((tselftmsgtdata((s1/tmp/pip-install-A1qMVe/paramiko/paramiko/pkey.pyt__init__BscCst�S(s�
        Return a string of an SSH `.Message` made up of the public part(s) of
        this key.  This string is suitable for passing to `__init__` to
        re-create the key object later.
        (tbytes(R((s1/tmp/pip-install-A1qMVe/paramiko/paramiko/pkey.pytasbytesTscCs
|j�S(N(R(R((s1/tmp/pip-install-A1qMVe/paramiko/paramiko/pkey.pyt__str__\scCsJt|�}t|�}||kr1t||�St|j�|j��S(sB
        Compare this key to another.  Returns 0 if this key is equivalent to
        the given key, or non-0 if they are different.  Only the public parts
        of the key are compared, so a public key will compare equal to its
        corresponding private key.

        :param .PKey other: key to compare to.
        (thashtcmpR(Rtotherthstho((s1/tmp/pip-install-A1qMVe/paramiko/paramiko/pkey.pyt__cmp__bs
	
cCst|�t|�kS(N(R(RR((s1/tmp/pip-install-A1qMVe/paramiko/paramiko/pkey.pyt__eq__qscCsdS(s�
        Return the name of this private key implementation.

        :return:
            name of this private key type, in SSH terminology, as a `str` (for
            example, ``"ssh-rsa"``).
        t((R((s1/tmp/pip-install-A1qMVe/paramiko/paramiko/pkey.pytget_nametscCsdS(s�
        Return the number of significant bits in this key.  This is useful
        for judging the relative security of a key.

        :return: bits in the key (as an `int`)
        i((R((s1/tmp/pip-install-A1qMVe/paramiko/paramiko/pkey.pytget_bits~scCstS(sf
        Return ``True`` if this key has the private part necessary for signing
        data.
        (tFalse(R((s1/tmp/pip-install-A1qMVe/paramiko/paramiko/pkey.pytcan_sign�scCst|j��j�S(s�
        Return an MD5 fingerprint of the public part of this key.  Nothing
        secret is revealed.

        :return:
            a 16-byte `string <str>` (binary) of the MD5 fingerprint, in SSH
            format.
        (RRtdigest(R((s1/tmp/pip-install-A1qMVe/paramiko/paramiko/pkey.pytget_fingerprint�s	cCs"tt|j���jdd�S(s+
        Return a base64 string containing the public part of this key.  Nothing
        secret is revealed.  This format is compatible with that used to store
        public key files or recognized host keys.

        :return: a base64 `string <str>` containing the public part of the key.
        s
R$(R	R
Rtreplace(R((s1/tmp/pip-install-A1qMVe/paramiko/paramiko/pkey.pyt
get_base64�scCst�S(s�
        Sign a blob of data with this private key, and return a `.Message`
        representing an SSH signature message.

        :param str data: the data to sign.
        :return: an SSH signature `message <.Message>`.
        (R(RR((s1/tmp/pip-install-A1qMVe/paramiko/paramiko/pkey.pyt
sign_ssh_data�scCstS(s\
        Given a blob of data, and an SSH message representing a signature of
        that data, verify that it was signed with this key.

        :param str data: the data that was signed.
        :param .Message msg: an SSH signature message
        :return:
            ``True`` if the signature verifies correctly; ``False`` otherwise.
        (R'(RRR((s1/tmp/pip-install-A1qMVe/paramiko/paramiko/pkey.pytverify_ssh_sig�s
cCs|d|d|�}|S(s�
        Create a key object by reading a private key file.  If the private
        key is encrypted and ``password`` is not ``None``, the given password
        will be used to decrypt the key (otherwise `.PasswordRequiredException`
        is thrown).  Through the magic of Python, this factory method will
        exist in all subclasses of PKey (such as `.RSAKey` or `.DSSKey`), but
        is useless on the abstract PKey class.

        :param str filename: name of the file to read
        :param str password:
            an optional password to use to decrypt the key file, if it's
            encrypted
        :return: a new `.PKey` based on the given private key

        :raises: ``IOError`` -- if there was an error reading the file
        :raises: `.PasswordRequiredException` -- if the private key file is
            encrypted, and ``password`` is ``None``
        :raises: `.SSHException` -- if the key file is invalid
        tfilenametpassword((tclsR/R0tkey((s1/tmp/pip-install-A1qMVe/paramiko/paramiko/pkey.pytfrom_private_key_file�scCs|d|d|�}|S(s
        Create a key object by reading a private key from a file (or file-like)
        object.  If the private key is encrypted and ``password`` is not
        ``None``, the given password will be used to decrypt the key (otherwise
        `.PasswordRequiredException` is thrown).

        :param file_obj: the file-like object to read from
        :param str password:
            an optional password to use to decrypt the key, if it's encrypted
        :return: a new `.PKey` based on the given private key

        :raises: ``IOError`` -- if there was an error reading the key
        :raises: `.PasswordRequiredException` --
            if the private key file is encrypted, and ``password`` is ``None``
        :raises: `.SSHException` -- if the key file is invalid
        tfile_objR0((R1R4R0R2((s1/tmp/pip-install-A1qMVe/paramiko/paramiko/pkey.pytfrom_private_key�scCstd��dS(s�
        Write private key contents into a file.  If the password is not
        ``None``, the key is encrypted before writing.

        :param str filename: name of the file to write
        :param str password:
            an optional password to use to encrypt the key file

        :raises: ``IOError`` -- if there was an error writing the file
        :raises: `.SSHException` -- if the key is invalid
        sNot implemented in PKeyN(t	Exception(RR/R0((s1/tmp/pip-install-A1qMVe/paramiko/paramiko/pkey.pytwrite_private_key_file�scCstd��dS(s�
        Write private key contents into a file (or file-like) object.  If the
        password is not ``None``, the key is encrypted before writing.

        :param file_obj: the file-like object to write into
        :param str password: an optional password to use to encrypt the key

        :raises: ``IOError`` -- if there was an error writing to the file
        :raises: `.SSHException` -- if the key is invalid
        sNot implemented in PKeyN(R6(RR4R0((s1/tmp/pip-install-A1qMVe/paramiko/paramiko/pkey.pytwrite_private_key�scCs1t|d��}|j|||�}WdQX|S(s�
        Read an SSH2-format private key file, looking for a string of the type
        ``"BEGIN xxx PRIVATE KEY"`` for some ``xxx``, base64-decode the text we
        find, and return it as a string.  If the private key is encrypted and
        ``password`` is not ``None``, the given password will be used to
        decrypt the key (otherwise `.PasswordRequiredException` is thrown).

        :param str tag: ``"RSA"`` or ``"DSA"``, the tag used to mark the
            data block.
        :param str filename: name of the file to read.
        :param str password:
            an optional password to use to decrypt the key file, if it's
            encrypted.
        :return: data blob (`str`) that makes up the private key.

        :raises: ``IOError`` -- if there was an error reading the file.
        :raises: `.PasswordRequiredException` -- if the private key file is
            encrypted, and ``password`` is ``None``.
        :raises: `.SSHException` -- if the key file is invalid.
        trN(topent_read_private_key(RttagR/R0tfR((s1/tmp/pip-install-A1qMVe/paramiko/paramiko/pkey.pyt_read_private_key_filescCs�|j�}d}d|d}x6|t|�krX||j�|krX|d7}q#W|t|�kr�td|d��ni}|d7}xg|t|�kr�||jd�}t|�dkr�Pn|dj�||dj�<|d7}q�W|}	d|d}
x6|	t|�krH||	j�|
krH|	d7}	qWy&ttd	j|||	!���}Wn/t	j
jk
r�}td
t|���nXd|kr�|S|d}
|
dkr�td
j
|
���ny|djd�\}}Wntd��nX||jkr9tdj
|���n|dkrTtd��n|j|d}|j|d}|j|d}tt|��}tjt|||�}t||�||�dt��j�}|j|�|j�S(Nis-----BEGIN s PRIVATE KEY-----isnot a valid s private key files: s	-----END R$sbase64 decoding error: s	proc-types4,ENCRYPTEDs"Unknown private key structure "{}"sdek-infot,s(Can't parse DEK-info in private key filesUnknown private key cipher "{}"sPrivate key file is encryptedRRRtbackend(t	readlinestlentstripRtsplittlowerRRtjointbase64tbinasciitErrortstrtformatt
_CIPHER_TABLEtNoneRRRtgenerate_key_bytesRRRt	decryptortupdatetfinalize(RR<R=R0tlineststarttbeginning_of_keytheaderstltendt
ending_of_keyRtet	proc_typetencryption_typetsaltstrRRRtsaltR2RO((s1/tmp/pip-install-A1qMVe/paramiko/paramiko/pkey.pyR;s\+
+&
'c
CsEt|d��0}tj|t�|j|||d|�WdQXdS(s�
        Write an SSH2-format private key file in a form that can be read by
        paramiko or openssh.  If no password is given, the key is written in
        a trivially-encoded format (base64) which is completely insecure.  If
        a password is given, DES-EDE3-CBC is used.

        :param str tag:
            ``"RSA"`` or ``"DSA"``, the tag used to mark the data block.
        :param filename: name of the file to write.
        :param str data: data blob that makes up the private key.
        :param str password: an optional password to use to encrypt the file.

        :raises: ``IOError`` -- if there was an error writing the file.
        twR0N(R:tostchmodRt_write_private_key(RR/R2RKR0R=((s1/tmp/pip-install-A1qMVe/paramiko/paramiko/pkey.pyt_write_private_key_fileTscCs\|dkrtj�}ntjt|��}|j|jtjj||�j	��dS(N(
RMRtNoEncryptiontBestAvailableEncryptionRtwritet
private_bytestEncodingtPEMtdecode(RR=R2RKR0t
encryption((s1/tmp/pip-install-A1qMVe/paramiko/paramiko/pkey.pyRagscCs�|}|}t|t�r'|g}nt|t�rB|g}n|dkr]td��n|j�|j�}||kr�nV||kr�|jt|j���|j	�n$d}t|j
|jj|���dS(s�
        Perform message type-checking & optional certificate loading.

        This includes fast-forwarding cert ``msg`` objects past the nonce, so
        that the subsequent fields are the key numbers; thus the caller may
        expect to treat the message as key material afterwards either way.

        The obtained key type is returned for classes which need to know what
        it was (e.g. ECDSA.)
        sKey object may not be emptys%Invalid key (class: {}, data type: {}N(
t
isinstanceR
RMRtrewindtget_texttload_certificateRRt
get_stringRKt	__class__t__name__(RRtkey_typet	cert_typet	key_typest
cert_typesttype_terr((s1/tmp/pip-install-A1qMVe/paramiko/paramiko/pkey.pyt_check_type_and_load_certss"


cCs�t|t�rd}n!tjj|�r3d}nd}tt|�|�}|jj|j	��s�d}t
|j|j|j	����n||_dS(s5
        Supplement the private key contents with data loaded from an OpenSSH
        public key (``.pub``) or certificate (``-cert.pub``) file, a string
        containing such a file, or a `.Message` object.

        The .pub contents adds no real value, since the private key
        file includes sufficient information to derive the public
        key info. For certificates, however, this can be used on
        the client side to offer authentication requests to the server
        based on certificate instead of raw public key.

        See:
        https://github.com/openssh/openssh-portable/blob/master/PROTOCOL.certkeys

        Note: very little effort is made to validate the certificate contents,
        that is for the server to decide if it is good enough to authenticate
        successfully.
        tfrom_messaget	from_filetfrom_strings0PublicBlob type {} incompatible with key type {}N(
RkRR_tpathtisfiletgetattrt
PublicBlobRrt
startswithR%t
ValueErrorRKtpublic_blob(RtvaluetconstructortblobRw((s1/tmp/pip-install-A1qMVe/paramiko/paramiko/pkey.pyRn�s		$N(!Rqt
__module__t__doc__RtAESRtCBCt	TripleDESRLRMRRRR"R#R%R&R(R*R,R-R.tclassmethodR3R5R7R8R>R;RbRaRxRn(((s1/tmp/pip-install-A1qMVe/paramiko/paramiko/pkey.pyR'sR


					
					
	
	
:	/RcBsbeZdZdd�Zed��Zed��Zed��Zd�Z	d�Z
d�ZRS(	s�
    OpenSSH plain public key or OpenSSH signed public key (certificate).

    Tries to be as dumb as possible and barely cares about specific
    per-key-type data.

    ..note::
        Most of the time you'll want to call `from_file`, `from_string` or
        `from_message` for useful instantiation, the main constructor is
        basically "I should be using ``attrs`` for this."
    cCs||_||_||_dS(s�
        Create a new public blob of given type and contents.

        :param str type_: Type indicator, eg ``ssh-rsa``.
        :param blob: The blob bytes themselves.
        :param str comment: A comment, if one was given (e.g. file-based.)
        N(Rrtkey_blobtcomment(RRvR�R�((s1/tmp/pip-install-A1qMVe/paramiko/paramiko/pkey.pyR�s		cCs.t|��}|j�}WdQX|j|�S(sO
        Create a public blob from a ``-cert.pub``-style file on disk.
        N(R:treadR{(R1R/R=tstring((s1/tmp/pip-install-A1qMVe/paramiko/paramiko/pkey.pyRz�sc
Cs�|jd
d�}t|�dkrBd}t|j|���n|d}tt|d��}y|dj�}Wntk
r�d
}nXt	|�}|j
�}||kr�dj||�}	tdj|	���n|d|d|d	|�S(sI
        Create a public blob from a ``-cert.pub``-style string.
        is%Not enough fields for public blob: {}iis!key type={!r}, but blob type={!r}sInvalid PublicBlob contents: {}RvR�R�N(RDRMRBR�RKRRRCt
IndexErrorRRm(
R1R�tfieldsRRrR�R�tmt	blob_typetdeets((s1/tmp/pip-install-A1qMVe/paramiko/paramiko/pkey.pyR{�s"


cCs%|j�}|d|d|j��S(s�
        Create a public blob from a network `.Message`.

        Specifically, a cert-bearing pubkey auth packet, because by definition
        OpenSSH-style certificates 'are' their own network representation."
        RvR�(RmR(R1tmessageRv((s1/tmp/pip-install-A1qMVe/paramiko/paramiko/pkey.pyRyscCs8dj|j�}|jr4|dj|j�7}n|S(Ns{} public key/certificates- {}(RKRrR�(Rtret((s1/tmp/pip-install-A1qMVe/paramiko/paramiko/pkey.pyRs	cCs|o|o|j|jkS(N(R�(RR((s1/tmp/pip-install-A1qMVe/paramiko/paramiko/pkey.pyR#scCs||kS(N((RR((s1/tmp/pip-install-A1qMVe/paramiko/paramiko/pkey.pyt__ne__sN(RqR�R�RMRR�RzR{RyRR#R�(((s1/tmp/pip-install-A1qMVe/paramiko/paramiko/pkey.pyR�s			(!R�RGRHRR_thashlibRtcryptography.hazmat.backendsRtcryptography.hazmat.primitivesRt&cryptography.hazmat.primitives.ciphersRRRtparamikoRtparamiko.commonRtparamiko.py3compatR	R
RRR
tparamiko.ssh_exceptionRRtparamiko.messageRtobjectRR(((s1/tmp/pip-install-A1qMVe/paramiko/paramiko/pkey.pyt<module>s(��

https://t.me/AnonymousX5 - 2025