ok

Mini Shell

Direktori : /lib64/python3.6/site-packages/cryptography/hazmat/primitives/kdf/__pycache__/
Upload File :
Current File : //lib64/python3.6/site-packages/cryptography/hazmat/primitives/kdf/__pycache__/hkdf.cpython-36.pyc

3

l�_�@s�ddlmZmZmZddlZddlmZddlmZm	Z	m
Z
mZddlm
Z
ddlmZddlmZmZddlmZeje�Gd	d
�d
e��Zeje�Gdd�de��ZdS)
�)�absolute_import�division�print_functionN)�utils)�AlreadyFinalized�
InvalidKey�UnsupportedAlgorithm�_Reasons)�_get_backend)�HMACBackend)�
constant_time�hmac)�KeyDerivationFunctionc@s.eZdZd
dd�Zdd�Zdd�Zdd	�ZdS)�HKDFNcCsht|�}t|t�stdtj��||_|dkr:d|jj}ntj	d|�||_
||_t|j|||�|_
dS)Nz.Backend object does not implement HMACBackend.��salt)r
�
isinstancerrr	�BACKEND_MISSING_INTERFACE�
_algorithm�digest_sizer�_check_bytes�_salt�_backend�
HKDFExpand�_hkdf_expand)�self�	algorithm�lengthr�info�backend�r �/usr/lib64/python3.6/hkdf.py�__init__s
z
HKDF.__init__cCs(tj|j|j|jd�}|j|�|j�S)N)r)r
�HMACrrr�update�finalize)r�key_material�hr r r!�_extract-s
z
HKDF._extractcCstjd|�|jj|j|��S)Nr&)r�_check_bytesliker�deriver()rr&r r r!r*2szHKDF.derivecCstj|j|�|�st�dS)N)r�bytes_eqr*r)rr&�expected_keyr r r!�verify6szHKDF.verify)N)�__name__�
__module__�__qualname__r"r(r*r-r r r r!rs
rc@s.eZdZd
dd�Zdd�Zdd�Zdd	�ZdS)rNcCszt|�}t|t�stdtj��||_||_d|j}||krJt	dj
|���||_|dkr^d}ntj
d|�||_d|_dS)Nz.Backend object does not implement HMACBackend.�z*Can not derive keys larger than {} octets.�rF)r
rrrr	rrrr�
ValueError�format�_lengthrr�_info�_used)rrrrrZ
max_lengthr r r!r"=s"

zHKDFExpand.__init__cCs�dg}d}xr|jjt|�d|jkr|tj||j|jd�}|j|d�|j|j�|jt	j
|��|j|j��|d7}qWdj
|�d|j�S)Nr2�)r���)rr�lenr5r
r#rr$r6�sixZint2byte�appendr%�join)rr&�outputZcounterr'r r r!�_expand[szHKDFExpand._expandcCs&tjd|�|jrt�d|_|j|�S)Nr&T)rr)r7rr?)rr&r r r!r*is
zHKDFExpand.derivecCstj|j|�|�st�dS)N)rr+r*r)rr&r,r r r!r-qszHKDFExpand.verify)N)r.r/r0r"r?r*r-r r r r!r;s
r)Z
__future__rrrr;ZcryptographyrZcryptography.exceptionsrrrr	Zcryptography.hazmat.backendsr
Z'cryptography.hazmat.backends.interfacesrZcryptography.hazmat.primitivesrr
Z"cryptography.hazmat.primitives.kdfrZregister_interface�objectrrr r r r!�<module>s$

Zerion Mini Shell 1.0