HEX
Server: Apache
System: Linux scp1.abinfocom.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: confeduphaar (1010)
PHP: 8.1.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //lib/python3/dist-packages/cryptography/hazmat/primitives/asymmetric/__pycache__/ec.cpython-38.pyc
U

�e�]�5�&@s�ddlmZmZmZddlZddlZddlZddlmZddl	m
Z
Gdd�de�Ze�
ej�Gdd�de��Ze�
ej�Gd	d
�d
e��Ze�
ej�Gdd�de��Ze�
ej�Gd
d�de��Ze�
ej�Gdd�de��ZeZe�e�Gdd�de��Ze�e�Gdd�de��Ze�e�Gdd�de��Ze�e�Gdd�de��Ze�e�Gdd�de��Ze�e�Gdd�de��Ze�e�Gdd�de��Ze�e�Gdd �d e��Ze�e�Gd!d"�d"e��Ze�e�Gd#d$�d$e��Ze�e�Gd%d&�d&e��Z e�e�Gd'd(�d(e��Z!e�e�Gd)d*�d*e��Z"e�e�Gd+d,�d,e��Z#e�e�Gd-d.�d.e��Z$e�e�Gd/d0�d0e��Z%e�e�Gd1d2�d2e��Z&e�e�Gd3d4�d4e��Z'e�e�Gd5d6�d6e��Z(e%e"e%e$e"e!e e#eeeeeeeeeee&e'e(d7�Z)e�e�Gd8d9�d9e��Z*d:d;�Z+d<d=�Z,Gd>d?�d?e�Z-Gd@dA�dAe�Z.GdBdC�dCe�Z/ej%e%ej$e$ej#e#ej"e"ej!e!ej e ej0e&ej1e'ej2e(ejeejeejeejeejeejeejeejeejeejeiZ3dDdE�Z4dS)F�)�absolute_import�division�print_functionN)�utils)�ObjectIdentifierc@s�eZdZed�Zed�Zed�Zed�Zed�Zed�Z	ed�Z
ed�Zed	�Zed
�Z
ed�Zed�Zed
�Zed�Zed�Zed�Zed�Zed�Zed�ZdS)�EllipticCurveOIDz1.2.840.10045.3.1.1z1.3.132.0.33z1.3.132.0.10z1.2.840.10045.3.1.7z1.3.132.0.34z1.3.132.0.35z1.3.36.3.3.2.8.1.1.7z1.3.36.3.3.2.8.1.1.11z1.3.36.3.3.2.8.1.1.13z1.3.132.0.1z1.3.132.0.15z1.3.132.0.26z1.3.132.0.27z1.3.132.0.16z1.3.132.0.17z1.3.132.0.36z1.3.132.0.37z1.3.132.0.38z1.3.132.0.39N)�__name__�
__module__�__qualname__r�	SECP192R1�	SECP224R1�	SECP256K1�	SECP256R1�	SECP384R1�	SECP521R1�BRAINPOOLP256R1�BRAINPOOLP384R1�BRAINPOOLP512R1�	SECT163K1�	SECT163R2�	SECT233K1�	SECT233R1�	SECT283K1�	SECT283R1�	SECT409K1�	SECT409R1�	SECT571K1�	SECT571R1�rr�N/usr/lib/python3/dist-packages/cryptography/hazmat/primitives/asymmetric/ec.pyrs&rc@s(eZdZejdd��Zejdd��ZdS)�
EllipticCurvecCsdS)z8
        The name of the curve. e.g. secp256r1.
        Nr��selfrrr�name(szEllipticCurve.namecCsdS�z<
        Bit size of a secret scalar for the curve.
        Nrr!rrr�key_size.szEllipticCurve.key_sizeN)rr	r
�abc�abstractpropertyr#r%rrrrr &s
r c@seZdZejdd��ZdS)�EllipticCurveSignatureAlgorithmcCsdS)z@
        The digest algorithm used with this signature.
        Nrr!rrr�	algorithm7sz)EllipticCurveSignatureAlgorithm.algorithmN)rr	r
r&r'r)rrrrr(5sr(c@s`eZdZejdd��Zejdd��Zejdd��Zejdd��Z	ejd	d
��Z
ejdd��Zd
S)�EllipticCurvePrivateKeycCsdS)zN
        Returns an AsymmetricSignatureContext used for signing data.
        Nr)r"�signature_algorithmrrr�signer@szEllipticCurvePrivateKey.signercCsdS)z}
        Performs a key exchange operation using the provided algorithm with the
        provided peer's public key.
        Nr)r"r)Zpeer_public_keyrrr�exchangeFsz EllipticCurvePrivateKey.exchangecCsdS)zB
        The EllipticCurvePublicKey for this private key.
        Nrr!rrr�
public_keyMsz"EllipticCurvePrivateKey.public_keycCsdS�z8
        The EllipticCurve that this key is on.
        Nrr!rrr�curveSszEllipticCurvePrivateKey.curvecCsdSr$rr!rrrr%Ysz EllipticCurvePrivateKey.key_sizecCsdS)z 
        Signs the data
        Nr)r"�datar+rrr�sign_szEllipticCurvePrivateKey.signN)rr	r
r&�abstractmethodr,r-r.r'r0r%r2rrrrr*>s




r*c@s(eZdZejdd��Zejdd��ZdS)�(EllipticCurvePrivateKeyWithSerializationcCsdS)z9
        Returns an EllipticCurvePrivateNumbers.
        Nrr!rrr�private_numbershsz8EllipticCurvePrivateKeyWithSerialization.private_numberscCsdS�z6
        Returns the key serialized as bytes.
        Nr)r"�encoding�formatZencryption_algorithmrrr�
private_bytesnsz6EllipticCurvePrivateKeyWithSerialization.private_bytesN)rr	r
r&r3r5r9rrrrr4fs
r4c@sleZdZejdd��Zejdd��Zejdd��Zejdd��Z	ejd	d
��Z
ejdd��Zed
d��Z
dS)�EllipticCurvePublicKeycCsdS)zQ
        Returns an AsymmetricVerificationContext used for signing data.
        Nr)r"�	signaturer+rrr�verifierwszEllipticCurvePublicKey.verifiercCsdSr/rr!rrrr0}szEllipticCurvePublicKey.curvecCsdSr$rr!rrrr%�szEllipticCurvePublicKey.key_sizecCsdS)z8
        Returns an EllipticCurvePublicNumbers.
        Nrr!rrr�public_numbers�sz%EllipticCurvePublicKey.public_numberscCsdSr6r)r"r7r8rrr�public_bytes�sz#EllipticCurvePublicKey.public_bytescCsdS)z5
        Verifies the signature of the data.
        Nr)r"r;r1r+rrr�verify�szEllipticCurvePublicKey.verifycCsbt�d|�t|t�std��t|�dkr2td��t�|d�dkrJtd��ddl	m
}|�||�S)Nr1�'curve must be an EllipticCurve instancerz%data must not be an empty byte string)����%Unsupported elliptic curve point type)�backend)r�_check_bytes�
isinstancer �	TypeError�len�
ValueError�sixZ
indexbytesZ,cryptography.hazmat.backends.openssl.backendrEZ load_elliptic_curve_public_bytes)�clsr0r1rErrr�from_encoded_point�s
z)EllipticCurvePublicKey.from_encoded_pointN)rr	r
r&r3r<r'r0r%r=r>r?�classmethodrMrrrrr:us





r:c@seZdZdZdZdS)r�	sect571r1i:N�rr	r
r#r%rrrrr�src@seZdZdZdZdS)r�	sect409r1�NrPrrrrr�src@seZdZdZdZdS)r�	sect283r1�NrPrrrrr�src@seZdZdZdZdS)r�	sect233r1��NrPrrrrr�src@seZdZdZdZdS)r�	sect163r2�NrPrrrrr�src@seZdZdZdZdS)r�	sect571k1i;NrPrrrrr�src@seZdZdZdZdS)r�	sect409k1rRNrPrrrrr�src@seZdZdZdZdS)r�	sect283k1rTNrPrrrrr�src@seZdZdZdZdS)r�	sect233k1rVNrPrrrrr�src@seZdZdZdZdS)r�	sect163k1rXNrPrrrrr�src@seZdZdZdZdS)r�	secp521r1i	NrPrrrrr�src@seZdZdZdZdS)r�	secp384r1�NrPrrrrr�src@seZdZdZdZdS)r�	secp256r1�NrPrrrrr�src@seZdZdZdZdS)r
�	secp256k1rbNrPrrrrr
�sr
c@seZdZdZdZdS)r�	secp224r1��NrPrrrrrsrc@seZdZdZdZdS)r�	secp192r1�NrPrrrrr	src@seZdZdZdZdS)�BrainpoolP256R1�brainpoolP256r1rbNrPrrrrrhsrhc@seZdZdZdZdS)�BrainpoolP384R1�brainpoolP384r1r`NrPrrrrrjsrjc@seZdZdZdZdS)�BrainpoolP512R1�brainpoolP512r1iNrPrrrrrlsrl)Z
prime192v1Z
prime256v1rfrdrar_r^rcr]r\r[rZrYrWrUrSrQrOrirkrmc@seZdZdd�Ze�d�ZdS)�ECDSAcCs
||_dS�N)�
_algorithm)r"r)rrr�__init__@szECDSA.__init__rpN)rr	r
rqr�read_only_propertyr)rrrrrn>srncCs
|�|�Sro)Z#generate_elliptic_curve_private_key)r0rErrr�generate_private_keyFsrscCsBt|tj�std��|dkr$td��t|t�s6td��|�||�S)Nz&private_value must be an integer type.rz)private_value must be a positive integer.�/curve must provide the EllipticCurve interface.)rGrK�
integer_typesrHrJr Z!derive_elliptic_curve_private_key)�
private_valuer0rErrr�derive_private_keyJs
rwc@sneZdZdd�Zdd�Zdd�Zedd��Ze�	d	�Z
e�	d
�Ze�	d�Zdd
�Z
dd�Zdd�Zdd�ZdS)�EllipticCurvePublicNumberscCsHt|tj�rt|tj�s td��t|t�s2td��||_||_||_dS)Nzx and y must be integers.rt)rGrKrurHr �_y�_x�_curve)r"�x�yr0rrrrqXs
�
�
z#EllipticCurvePublicNumbers.__init__cCs
|�|�Sro)Z"load_elliptic_curve_public_numbers�r"rErrrr.fsz%EllipticCurvePublicNumbers.public_keycCsBtjdtjdd�|jjdd}dt�|j|�t�|j|�S)Nz�encode_point has been deprecated on EllipticCurvePublicNumbers and will be removed in a future version. Please use EllipticCurvePublicKey.public_bytes to obtain both compressed and uncompressed point encoding.rA��
stacklevel���)	�warnings�warnr�DeprecatedIn25r0r%Zint_to_bytesr|r})r"�byte_lengthrrr�encode_pointis�	��z'EllipticCurvePublicNumbers.encode_pointcCs�t|t�std��tjdtjdd�|�d�r�|jdd}t	|�d|dkr�t�
|d|d�d	�}t�
||dd�d	�}||||�Std
��ntd��dS)Nr@z�Support for unsafe construction of public numbers from encoded data will be removed in a future version. Please use EllipticCurvePublicKey.from_encoded_pointrArr�r�r��Zbigz(Invalid elliptic curve point data lengthrD)rGr rHr�r�rr��
startswithr%rIZint_from_bytesrJ)rLr0r1r�r|r}rrrrMys
�

z-EllipticCurvePublicNumbers.from_encoded_pointr{rzrycCsFt|t�stS|j|jkoD|j|jkoD|jj|jjkoD|jj|jjkSro)rGrx�NotImplementedr|r}r0r#r%�r"�otherrrr�__eq__�s

���z!EllipticCurvePublicNumbers.__eq__cCs
||kSrorr�rrr�__ne__�sz!EllipticCurvePublicNumbers.__ne__cCst|j|j|jj|jjf�Sro)�hashr|r}r0r#r%r!rrr�__hash__�sz#EllipticCurvePublicNumbers.__hash__cCs
d�|�S)NzC<EllipticCurvePublicNumbers(curve={0.curve.name}, x={0.x}, y={0.y}>)r8r!rrr�__repr__�s��z#EllipticCurvePublicNumbers.__repr__N)rr	r
rqr.r�rNrMrrrr0r|r}r�r�r�r�rrrrrxWs



rxc@sHeZdZdd�Zdd�Ze�d�Ze�d�Zdd�Z	d	d
�Z
dd�Zd
S)�EllipticCurvePrivateNumberscCs6t|tj�std��t|t�s&td��||_||_dS)Nz!private_value must be an integer.z>public_numbers must be an EllipticCurvePublicNumbers instance.)rGrKrurHrx�_private_value�_public_numbers)r"rvr=rrrrq�s
�z$EllipticCurvePrivateNumbers.__init__cCs
|�|�Sro)Z#load_elliptic_curve_private_numbersr~rrr�private_key�sz'EllipticCurvePrivateNumbers.private_keyr�r�cCs&t|t�stS|j|jko$|j|jkSro)rGr�r�rvr=r�rrrr��s


�z"EllipticCurvePrivateNumbers.__eq__cCs
||kSrorr�rrrr��sz"EllipticCurvePrivateNumbers.__ne__cCst|j|jf�Sro)r�rvr=r!rrrr��sz$EllipticCurvePrivateNumbers.__hash__N)rr	r
rqr�rrrrvr=r�r�r�rrrrr��s


	r�c@seZdZdS)�ECDHN)rr	r
rrrrr��sr�cCs,z
t|WStk
r&td��YnXdS)NzCThe provided object identifier has no matching elliptic curve class)�
_OID_TO_CURVE�KeyError�LookupError)Zoidrrr�get_curve_for_oid�s
�r�)5Z
__future__rrrr&r�rKZcryptographyrZcryptography.hazmat._oidr�objectrZ
add_metaclass�ABCMetar r(r*r4r:Z'EllipticCurvePublicKeyWithSerializationZregister_interfacerrrrrrrrrrrrrr
rrrhrjrlZ_CURVE_TYPESrnrsrwrxr�r�rrrr�r�rrrr�<module>s�


'

6�
W$�