관리-도구
편집 파일: utils.cpython-36.opt-1.pyc
3 l�_ � @ sd d dl mZmZmZ d dlZd dlmZ d dlmZ d dl m Z dd� Zdd � Zd d� Z dd � ZdS )� )�absolute_import�division�print_functionN)�utils)�hashes)� Prehashedc C s� | j j|| jj�}| j|| jjk� | jj|| j j�}| j j|�}| j|dk� | j j||j �}| j|dk� | jj d�}| j j|| jj|�}| j|dk� | j|d dk� | jj d|d �}| j j|||�}|dkr�td��| jj ||d �d d � S )N� zsize_t *r zunsigned char[]z1Null shared key derived from public/private pair.)Z_libZEVP_PKEY_CTX_newZ_ffiZNULLZopenssl_assert�gcZEVP_PKEY_CTX_freeZEVP_PKEY_derive_initZEVP_PKEY_derive_set_peerZ _evp_pkey�newZEVP_PKEY_derive� ValueError�buffer)�backendZevp_pkeyZpeer_public_keyZctx�resZkeylenZbuf� r �/usr/lib64/python3.6/utils.py�_evp_pkey_derive s r c C sN t |t�s*tj|| �}|j|� |j� }n|j}t|�|jkrFt d��||fS )NzNThe provided data must be the same length as the hash algorithm's digest size.) � isinstancer r ZHash�update�finalizeZ _algorithm�lenZdigest_sizer )r �data� algorithmZhash_ctxr r r �_calculate_digest_and_algorithm"