관리-도구
편집 파일: ed448.cpython-36.pyc
3 y�_� � @ s� d dl mZmZmZ d dlmZmZ d dlmZ d dl m Z mZ dZdZ eje�G dd� de��Zeje �G d d � d e��ZdS )� )�absolute_import�division�print_function)� exceptions�utils)� serialization)�Ed448PrivateKey�Ed448PublicKey�9 �r c @ s, e Zd Zdd� Zdd� Zdd� Zdd� Zd S ) �_Ed448PublicKeyc C s || _ || _d S )N)�_backend� _evp_pkey)�self�backend�evp_pkey� r �/usr/lib64/python3.6/ed448.py�__init__ s z_Ed448PublicKey.__init__c C sV |t jjks|t jjkr@|t jjk s0|t jjk r8td��| j� S | jj||| | jd �S )Nz3When using Raw both encoding and format must be Raw) r �Encoding�Raw�PublicFormat� ValueError�_raw_public_bytesr Z_public_key_bytesr )r �encoding�formatr r r �public_bytes s z_Ed448PublicKey.public_bytesc C sp | j jjdt�}| j jjdt�}| j jj| j||�}| j j|dk� | j j|d tk� | j jj|t�d d � S )Nzunsigned char []zsize_t *� r ) r �_ffi�new�_ED448_KEY_SIZE�_lib�EVP_PKEY_get_raw_public_keyr �openssl_assert�buffer)r �buf�buflen�resr r r r + s z!_Ed448PublicKey._raw_public_bytesc C s� | j jj� }| j j|| j jjk� | j jj|| j jj�}| j jj|| j jj| j jj| j jj| j �}| j j|dk� | j jj ||t|�|t|��}|dkr�| j j� t j�d S )Nr )r r! �Cryptography_EVP_MD_CTX_newr# r �NULL�gc�Cryptography_EVP_MD_CTX_freeZEVP_DigestVerifyInitr ZEVP_DigestVerify�lenZ_consume_errorsr ZInvalidSignature)r Z signature�data� evp_md_ctxr'