3
ãdeÙ  ã               @   sŒ   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dƒr\e
jejj
ƒ G d	d
„ d
e j	d�Zeedƒrˆejejjƒ dS )é    N)ÚUnsupportedAlgorithmÚ_Reasons)Úopenssl)Ú_serializationc               @   sP   e Zd Zeed dœdd„ƒZejej	ej
edœdd„ƒZejedœdd	„ƒZd
S )ÚX25519PublicKey)ÚdataÚreturnc             C   s*   ddl m} |jƒ s tdtjƒ‚|j|ƒS )Nr   )Úbackendz3X25519 is not supported by this version of OpenSSL.)Ú,cryptography.hazmat.backends.openssl.backendr	   Úx25519_supportedr   r   ÚUNSUPPORTED_EXCHANGE_ALGORITHMZx25519_load_public_bytes)Úclsr   r	   © r   úg/var/www/agendate/envp3/lib/python3.6/site-packages/cryptography/hazmat/primitives/asymmetric/x25519.pyÚfrom_public_bytes   s    z!X25519PublicKey.from_public_bytes)Ú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_rawN)Ú__name__Ú
__module__Ú__qualname__ÚclassmethodÚbytesr   ÚabcÚabstractmethodr   ÚEncodingZPublicFormatr   r   r   r   r   r   r      s   r   )Ú	metaclassÚx25519c               @   s�   e Zd Zed dœdd„ƒZeed dœdd„ƒZeje	dœdd„ƒZ
ejejejejed	œd
d„ƒZejedœdd„ƒZeje	edœdd„ƒZdS )ÚX25519PrivateKey)r   c             C   s(   ddl m} |jƒ s tdtjƒ‚|jƒ S )Nr   )r	   z3X25519 is not supported by this version of OpenSSL.)r
   r	   r   r   r   r   Zx25519_generate_key)r   r	   r   r   r   Úgenerate2   s    zX25519PrivateKey.generate)r   r   c             C   s*   ddl m} |jƒ s tdtjƒ‚|j|ƒS )Nr   )r	   z3X25519 is not supported by this version of OpenSSL.)r
   r	   r   r   r   r   Zx25519_load_private_bytes)r   r   r	   r   r   r   Úfrom_private_bytes=   s    z#X25519PrivateKey.from_private_bytesc             C   s   dS )zJ
        Returns the public key assosciated with this private key
        Nr   )r   r   r   r   Ú
public_keyI   s    zX25519PrivateKey.public_key)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_bytesO   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_rawZ   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   Úexchangea   s    zX25519PrivateKey.exchangeN)r   r   r   r   r!   r   r"   r   r   r   r#   r   r   ZPrivateFormatZKeySerializationEncryptionr%   r&   r(   r   r   r   r   r    1   s   
r    )r   Zcryptography.exceptionsr   r   Z"cryptography.hazmat.bindings._rustr   Zrust_opensslZcryptography.hazmat.primitivesr   ÚABCMetar   ÚhasattrÚregisterr   r    r   r   r   r   Ú<module>   s    
8
