B
    uf                 @  s   d dl mZ d dlZd dlmZmZ d dlmZ d dl	m
Z
 G dd dejdZeejj G d	d
 d
ejdZeejj dS )    )annotationsN)UnsupportedAlgorithm_Reasons)openssl)_serializationc               @  sb   e Zd Zedd dddZejdddddd	Zejdd
ddZejdddddZ	dS )X25519PublicKeybytes)datareturnc             C  s,   ddl m} | s tdtjtj|S )Nr   )backendz3X25519 is not supported by this version of OpenSSL.)	,cryptography.hazmat.backends.openssl.backendr   x25519_supportedr   r   UNSUPPORTED_EXCHANGE_ALGORITHMrust_opensslx25519from_public_bytes)clsr	   r    r   r/home/ankuromar296_gmail_com/myenv/lib/python3.7/site-packages/cryptography/hazmat/primitives/asymmetric/x25519.pyr      s    z!X25519PublicKey.from_public_bytesz_serialization.Encodingz_serialization.PublicFormat)encodingformatr
   c             C  s   dS )z9
        The serialized bytes of the public key.
        Nr   )selfr   r   r   r   r   public_bytes   s    zX25519PublicKey.public_bytes)r
   c             C  s   dS )z`
        The raw bytes of the public key.
        Equivalent to public_bytes(Raw, Raw).
        Nr   )r   r   r   r   public_bytes_raw%   s    z X25519PublicKey.public_bytes_rawobjectbool)otherr
   c             C  s   dS )z"
        Checks equality.
        Nr   )r   r   r   r   r   __eq__,   s    zX25519PublicKey.__eq__N)
__name__
__module____qualname__classmethodr   abcabstractmethodr   r   r   r   r   r   r   r      s   
r   )	metaclassc               @  s   e Zd Zed dddZedd dddZejddd	d
ZejdddddddZ	ejddddZ
ejdddddZdS )X25519PrivateKey)r
   c             C  s*   ddl m} | s tdtjtj S )Nr   )r   z3X25519 is not supported by this version of OpenSSL.)	r   r   r   r   r   r   r   r   Zgenerate_key)r   r   r   r   r   generate7   s    zX25519PrivateKey.generater   )r	   r
   c             C  s,   ddl m} | s tdtjtj|S )Nr   )r   z3X25519 is not supported by this version of OpenSSL.)	r   r   r   r   r   r   r   r   from_private_bytes)r   r	   r   r   r   r   r'   B   s    z#X25519PrivateKey.from_private_bytesr   c             C  s   dS )zI
        Returns the public key associated with this private key
        Nr   )r   r   r   r   
public_keyN   s    zX25519PrivateKey.public_keyz_serialization.Encodingz_serialization.PrivateFormatz)_serialization.KeySerializationEncryption)r   r   encryption_algorithmr
   c             C  s   dS )z:
        The serialized bytes of the private key.
        Nr   )r   r   r   r)   r   r   r   private_bytesT   s    	zX25519PrivateKey.private_bytesc             C  s   dS )zr
        The raw bytes of the private key.
        Equivalent to private_bytes(Raw, Raw, NoEncryption()).
        Nr   )r   r   r   r   private_bytes_raw_   s    z"X25519PrivateKey.private_bytes_raw)peer_public_keyr
   c             C  s   dS )zY
        Performs a key exchange operation using the provided peer's public key.
        Nr   )r   r,   r   r   r   exchangef   s    zX25519PrivateKey.exchangeN)r   r   r    r!   r&   r'   r"   r#   r(   r*   r+   r-   r   r   r   r   r%   6   s   r%   )
__future__r   r"   Zcryptography.exceptionsr   r   Z"cryptography.hazmat.bindings._rustr   r   Zcryptography.hazmat.primitivesr   ABCMetar   registerr   r%   r   r   r   r   <module>   s   %7