관리-도구
편집 파일: x25519.cpython-36.pyc
3 l�_� � @ s� d dl mZmZmZ d dlmZ d dlmZ d dlm Z d dl mZmZ dZ eje�G dd� de��Zeje�G d d � d e��ZdS )� )�absolute_import�division�print_function)�utils)�_evp_pkey_derive)� serialization)�X25519PrivateKey�X25519PublicKey� c @ s$ e Zd Zdd� Zdd� Zdd� ZdS )�_X25519PublicKeyc C s || _ || _d S )N)�_backend� _evp_pkey)�self�backend�evp_pkey� r �/usr/lib64/python3.6/x25519.py�__init__ s z_X25519PublicKey.__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_X25519PublicKey.public_bytesc C s| | j jjd�}| j jj| j|�}| j j|dk� | j j|d | j jjk� | j jj|d | j jj �}| j jj ||�d d � S )Nzunsigned char **r r )r �_ffi�new�_libZEVP_PKEY_get1_tls_encodedpointr �openssl_assert�NULL�gcZOPENSSL_free�buffer)r Zucharpp�res�datar r r r , s z"_X25519PublicKey._raw_public_bytesN)�__name__� __module__�__qualname__r r r r r r r r s r c @ s4 e Zd Zdd� Zdd� Zdd� Zdd� Zd d � ZdS )�_X25519PrivateKeyc C s || _ || _d S )N)r r )r r r r r r r ; s z_X25519PrivateKey.__init__c C sz | j j� }| j jj|| j�}| j j|dk� | j jj|| j jj�}| j j|| j jjk� | j jj || j jj �}t| j |�S )N� )r �_create_mem_bio_gcr Zi2d_PUBKEY_bior r Zd2i_PUBKEY_bior r r! Z EVP_PKEY_freer )r �bior# r r r r � public_key? s z_X25519PrivateKey.public_keyc C s"