%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /proc/self/root/opt/plesk/python/2.7/lib/python2.7/site-packages/ecdsa/
Upload File :
Create Path :
Current File : //proc/self/root/opt/plesk/python/2.7/lib/python2.7/site-packages/ecdsa/ecdh.pyc

�
�ac@s�dZddlmZddlmZddlmZmZddddd	gZde	fd
��YZ
de	fd��YZde	fd��YZd	e	fd
��YZ
defd��YZdS(sG
Class for performing Elliptic-curve Diffie-Hellman (ECDH) operations.
i(tnumber_to_string(tINFINITY(t
SigningKeytVerifyingKeytECDHt
NoKeyErrortNoCurveErrortInvalidCurveErrortInvalidSharedSecretErrorcBseZdZRS(s3ECDH. Key not found but it is needed for operation.(t__name__t
__module__t__doc__(((s?/opt/plesk/python/2.7/lib/python2.7/site-packages/ecdsa/ecdh.pyRscBseZdZRS(s3ECDH. Curve not set but it is needed for operation.(R	R
R(((s?/opt/plesk/python/2.7/lib/python2.7/site-packages/ecdsa/ecdh.pyRscBseZdZRS(sFECDH. Raised in case the public and private keys use different curves.(R	R
R(((s?/opt/plesk/python/2.7/lib/python2.7/site-packages/ecdsa/ecdh.pyRscBseZdZRS(sBECDH. Raised in case the shared secret we obtained is an INFINITY.(R	R
R(((s?/opt/plesk/python/2.7/lib/python2.7/site-packages/ecdsa/ecdh.pyR scBs�eZdZdddd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d�Zd	�Zd
�Z
d�Zd�Zd
�Zd�Zd�ZRS(s�
    Elliptic-curve Diffie-Hellman (ECDH). A key agreement protocol.

    Allows two parties, each having an elliptic-curve public-private key
    pair, to establish a shared secret over an insecure channel
    cCsK||_d|_d|_|r1|j|�n|rG|j|�ndS(s	
        ECDH init.

        Call can be initialised without parameters, then the first operation
        (loading either key) will set the used curve.
        All parameters must be ultimately set before shared secret
        calculation will be allowed.

        :param curve: curve for operations
        :type curve: Curve
        :param private_key: `my` private key for ECDH
        :type private_key: SigningKey
        :param public_key:  `their` public key for ECDH
        :type public_key: VerifyingKey
       N(tcurvetNonetprivate_keyt
public_keytload_private_keytload_received_public_key(tselfRRR((s?/opt/plesk/python/2.7/lib/python2.7/site-packages/ecdsa/ecdh.pyt__init__.s			cCs�|jstd��n|js0td��n|jj|jkoS|jknsgtd��n|jj|jjj}|t	kr�t
d��n|j�S(Ns3Private key needs to be set to create shared secrets2Public key needs to be set to create shared secrets3Curves for public key and private key is not equal.s!Invalid shared secret (INFINITY).(RRRRRtpubkeytpointtprivkeytsecret_multiplierRRtx(Rtremote_public_keytresult((s?/opt/plesk/python/2.7/lib/python2.7/site-packages/ecdsa/ecdh.pyt_get_shared_secretFs		(cCs
||_dS(s�
        Set the working curve for ecdh operations.

        :param key_curve: curve from `curves` module
        :type key_curve: Curve
        N(R(Rt	key_curve((s?/opt/plesk/python/2.7/lib/python2.7/site-packages/ecdsa/ecdh.pyt	set_curveYscCs4|jstd��n|jtjd|j��S(s
        Generate local private key for ecdh operation with curve that was set.

        :raises NoCurveError: Curve must be set before key generation.

        :return: public (verifying) key from this private key.
        :rtype: VerifyingKey object
        s*Curve must be set prior to key generation.R(RRRRtgenerate(R((s?/opt/plesk/python/2.7/lib/python2.7/site-packages/ecdsa/ecdh.pytgenerate_private_keybs		cCsO|js|j|_n|j|jkr9td��n||_|jj�S(s�
        Load private key from SigningKey (keys.py) object.

        Needs to have the same curve as was set with set_curve method.
        If curve is not set - it sets from this SigningKey

        :param private_key: Initialised SigningKey class
        :type private_key: SigningKey

        :raises InvalidCurveError: private_key curve not the same as self.curve

        :return: public (verifying) key from this private key.
        :rtype: VerifyingKey object
        sCurve mismatch.(RRRtget_verifying_key(RR((s?/opt/plesk/python/2.7/lib/python2.7/site-packages/ecdsa/ecdh.pyRos		cCs7|jstd��n|jtj|d|j��S(s�
        Load private key from byte string.

        Uses current curve and checks if the provided key matches
        the curve of ECDH key agreement.
        Key loads via from_string method of SigningKey class

        :param private_key: private key in bytes string format
        :type private_key: :term:`bytes-like object`

        :raises NoCurveError: Curve must be set before loading.

        :return: public (verifying) key from this private key.
        :rtype: VerifyingKey object
        s$Curve must be set prior to key load.R(RRRRtfrom_string(RR((s?/opt/plesk/python/2.7/lib/python2.7/site-packages/ecdsa/ecdh.pytload_private_key_bytes�s	cCs|jtj|��S(s>
        Load private key from DER byte string.

        Compares the curve of the DER-encoded key with the ECDH set curve,
        uses the former if unset.

        Note, the only DER format supported is the RFC5915
        Look at keys.py:SigningKey.from_der()

        :param private_key_der: string with the DER encoding of private ECDSA key
        :type private_key_der: string

        :raises InvalidCurveError: private_key curve not the same as self.curve

        :return: public (verifying) key from this private key.
        :rtype: VerifyingKey object
        (RRtfrom_der(Rtprivate_key_der((s?/opt/plesk/python/2.7/lib/python2.7/site-packages/ecdsa/ecdh.pytload_private_key_der�scCs|jtj|��S(sc
        Load private key from PEM string.

        Compares the curve of the DER-encoded key with the ECDH set curve,
        uses the former if unset.

        Note, the only PEM format supported is the RFC5915
        Look at keys.py:SigningKey.from_pem()
        it needs to have `EC PRIVATE KEY` section

        :param private_key_pem: string with PEM-encoded private ECDSA key
        :type private_key_pem: string

        :raises InvalidCurveError: private_key curve not the same as self.curve

        :return: public (verifying) key from this private key.
        :rtype: VerifyingKey object
        (RRtfrom_pem(Rtprivate_key_pem((s?/opt/plesk/python/2.7/lib/python2.7/site-packages/ecdsa/ecdh.pytload_private_key_pem�scCs
|jj�S(s�
        Provides a public key that matches the local private key.

        Needs to be sent to the remote party.

        :return: public (verifying) key from local private key.
        :rtype: VerifyingKey object
       (RR (R((s?/opt/plesk/python/2.7/lib/python2.7/site-packages/ecdsa/ecdh.pytget_public_key�s	cCsF|js|j|_n|j|jkr9td��n||_dS(s
        Load public key from VerifyingKey (keys.py) object.

        Needs to have the same curve as set as current for ecdh operation.
        If curve is not set - it sets it from VerifyingKey.

        :param public_key: Initialised VerifyingKey class
        :type public_key: VerifyingKey

        :raises InvalidCurveError: public_key curve not the same as self.curve
        sCurve mismatch.N(RRR(RR((s?/opt/plesk/python/2.7/lib/python2.7/site-packages/ecdsa/ecdh.pyR�s
	cCs|jtj||j��S(sK
        Load public key from byte string.

        Uses current curve and checks if key length corresponds to
        the current curve.
        Key loads via from_string method of VerifyingKey class

        :param public_key_str: public key in bytes string format
        :type public_key_str: :term:`bytes-like object`
        (RRR!R(Rtpublic_key_str((s?/opt/plesk/python/2.7/lib/python2.7/site-packages/ecdsa/ecdh.pytload_received_public_key_bytes�scCs|jtj|��S(s�
        Load public key from DER byte string.

        Compares the curve of the DER-encoded key with the ECDH set curve,
        uses the former if unset.

        Note, the only DER format supported is the RFC5912
        Look at keys.py:VerifyingKey.from_der()

        :param public_key_der: string with the DER encoding of public ECDSA key
        :type public_key_der: string

        :raises InvalidCurveError: public_key curve not the same as self.curve
        (RRR#(Rtpublic_key_der((s?/opt/plesk/python/2.7/lib/python2.7/site-packages/ecdsa/ecdh.pytload_received_public_key_der�scCs|jtj|��S(s�
        Load public key from PEM string.

        Compares the curve of the PEM-encoded key with the ECDH set curve,
        uses the former if unset.

        Note, the only PEM format supported is the RFC5912
        Look at keys.py:VerifyingKey.from_pem()

        :param public_key_pem: string with PEM-encoded public ECDSA key
        :type public_key_pem: string

        :raises InvalidCurveError: public_key curve not the same as self.curve
        (RRR&(Rtpublic_key_pem((s?/opt/plesk/python/2.7/lib/python2.7/site-packages/ecdsa/ecdh.pytload_received_public_key_pem�scCst|j�|jjj�S(s�
        Generate shared secret from local private key and remote public key.

        The objects needs to have both private key and received public key
        before generation is allowed.

        :raises InvalidCurveError: public_key curve not the same as self.curve
        :raises NoKeyError: public_key or private_key is not set

        :return: shared secret
        :rtype: byte string
        (Rtgenerate_sharedsecretRRtorder(R((s?/opt/plesk/python/2.7/lib/python2.7/site-packages/ecdsa/ecdh.pytgenerate_sharedsecret_bytess
	cCs|j|j�S(sE
        Generate shared secret from local private key and remote public key.

        The objects needs to have both private key and received public key
        before generation is allowed.

        It's the same for local and remote party.
        shared secret(local private key, remote public key ) ==
                shared secret (local public key, remote private key)

        :raises InvalidCurveError: public_key curve not the same as self.curve
        :raises NoKeyError: public_key or private_key is not set

        :return: shared secret
        :rtype: int
        (RR(R((s?/opt/plesk/python/2.7/lib/python2.7/site-packages/ecdsa/ecdh.pyR0!sN(R	R
RR
RRRRRR"R%R(R)RR+R-R/R2R0(((s?/opt/plesk/python/2.7/lib/python2.7/site-packages/ecdsa/ecdh.pyR&s 				
										N(RtutilRt
ellipticcurveRtkeysRRt__all__t	ExceptionRRRRtobjectR(((s?/opt/plesk/python/2.7/lib/python2.7/site-packages/ecdsa/ecdh.pyt<module>s	

Zerion Mini Shell 1.0