3
ãde  ã               @   sX   d dl Z d dlmZmZ d dlmZ dZdZG dd„ de jd�Z	G d	d
„ d
e jd�Z
dS )é    N)ÚUnsupportedAlgorithmÚ_Reasons)Ú_serializationé    é@   c               @   sb   e Zd Zeed dœdd„ƒZejej	ej
edœdd„ƒZedœdd	„Zejeed
dœdd„ƒZd
S )ÚEd25519PublicKey)ÚdataÚreturnc             C   s*   ddl m} |jƒ s tdtjƒ‚|j|ƒS )Nr   )Úbackendz4ed25519 is not supported by this version of OpenSSL.)Ú,cryptography.hazmat.backends.openssl.backendr
   Úed25519_supportedr   r   Ú UNSUPPORTED_PUBLIC_KEY_ALGORITHMZed25519_load_public_bytes)Úclsr   r
   © r   úh/var/www/agendate/envp3/lib/python3.6/site-packages/cryptography/hazmat/primitives/asymmetric/ed25519.pyÚfrom_public_bytes   s    z"Ed25519PublicKey.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Ed25519PublicKey.public_bytes)r	   c             C   s   | j tjjtjjƒS )z`
        The raw bytes of the public key.
        Equivalent to public_bytes(Raw, Raw).
        )r   r   ÚEncodingÚRawÚPublicFormat)r   r   r   r   Úpublic_bytes_raw&   s    z!Ed25519PublicKey.public_bytes_rawN)Ú	signaturer   r	   c             C   s   dS )z'
        Verify the signature.
        Nr   )r   r   r   r   r   r   Úverify/   s    zEd25519PublicKey.verify)Ú__name__Ú
__module__Ú__qualname__ÚclassmethodÚbytesr   ÚabcÚabstractmethodr   r   r   r   r   r   r   r   r   r   r      s   	r   )Ú	metaclassc               @   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dœdd„Zejeedœdd„ƒZdS )ÚEd25519PrivateKey)r	   c             C   s(   ddl m} |jƒ s tdtjƒ‚|jƒ S )Nr   )r
   z4ed25519 is not supported by this version of OpenSSL.)r   r
   r   r   r   r   Zed25519_generate_key)r   r
   r   r   r   Úgenerate7   s    zEd25519PrivateKey.generate)r   r	   c             C   s*   ddl m} |jƒ s tdtjƒ‚|j|ƒS )Nr   )r
   z4ed25519 is not supported by this version of OpenSSL.)r   r
   r   r   r   r   Zed25519_load_private_bytes)r   r   r
   r   r   r   Úfrom_private_bytesC   s    z$Ed25519PrivateKey.from_private_bytesc             C   s   dS )zD
        The Ed25519PublicKey derived from the private key.
        Nr   )r   r   r   r   Ú
public_keyO   s    zEd25519PrivateKey.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_bytesU   s    zEd25519PrivateKey.private_bytesc             C   s   | j tjjtjjtjƒ ƒS )zr
        The raw bytes of the private key.
        Equivalent to private_bytes(Raw, Raw, NoEncryption()).
        )r)   r   r   r   ÚPrivateFormatZNoEncryption)r   r   r   r   Úprivate_bytes_raw`   s    z#Ed25519PrivateKey.private_bytes_rawc             C   s   dS )z!
        Signs the data.
        Nr   )r   r   r   r   r   Úsignk   s    zEd25519PrivateKey.signN)r   r   r   r   r%   r    r&   r!   r"   r   r'   r   r   r*   ZKeySerializationEncryptionr)   r+   r,   r   r   r   r   r$   6   s   r$   )r!   Zcryptography.exceptionsr   r   Zcryptography.hazmat.primitivesr   Z_ED25519_KEY_SIZEZ_ED25519_SIG_SIZEÚABCMetar   r$   r   r   r   r   Ú<module>   s   '