HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //lib/python3/dist-packages/cryptography/hazmat/primitives/ciphers/__pycache__/modes.cpython-38.pyc
U

�)%a��@sHddlZddlZddlmZddlmZGdd�dejd�ZGdd�dejd�ZGd	d
�d
ejd�Z	Gdd�dejd�Z
Gd
d�dejd�Zdd�Zdd�Z
eed�dd�Zdd�ZGdd�dee�ZGdd�dee	�ZGdd�de�ZGdd�dee�ZGd d!�d!ee�ZGd"d#�d#ee�ZGd$d%�d%ee
�ZGd&d'�d'eee�ZdS)(�N)�utils)�CipherAlgorithmc@s6eZdZejed�dd��Zejedd�dd��Z	dS)�Mode��returncCsdS)z@
        A string naming this mode (e.g. "ECB", "CBC").
        N���selfrr�N/usr/lib/python3/dist-packages/cryptography/hazmat/primitives/ciphers/modes.py�namesz	Mode.nameN)�	algorithmrcCsdS)zq
        Checks that all the necessary invariants of this (mode, algorithm)
        combination are met.
        Nr�r	rrrr
�validate_for_algorithmszMode.validate_for_algorithm)
�__name__�
__module__�__qualname__�abc�abstractproperty�strr�abstractmethodrrrrrr
r
sr)�	metaclassc@s eZdZejed�dd��ZdS)�ModeWithInitializationVectorrcCsdS)zP
        The value of the initialization vector for this mode as bytes.
        Nrrrrr
�initialization_vectorsz2ModeWithInitializationVector.initialization_vectorN)rrrrr�bytesrrrrr
rsrc@s eZdZejed�dd��ZdS)�
ModeWithTweakrcCsdS)z@
        The value of the tweak for this mode as bytes.
        Nrrrrr
�tweak%szModeWithTweak.tweakN)rrrrrrrrrrr
r$src@s eZdZejed�dd��ZdS)�
ModeWithNoncercCsdS)z@
        The value of the nonce for this mode as bytes.
        Nrrrrr
�nonce-szModeWithNonce.nonceN)rrrrrrrrrrr
r,src@s eZdZejed�dd��ZdS)�ModeWithAuthenticationTagrcCsdS)zP
        The value of the tag supplied to the constructor of this mode.
        Nrrrrr
�tag5szModeWithAuthenticationTag.tagN)rrrrrrrrrrr
r4srcCs |jdkr|jdkrtd��dS)N��AESz=Only 128, 192, and 256 bit keys are allowed for this AES mode)�key_sizer�
ValueErrorr
rrr
�_check_aes_key_length<s�r$cCs0t|j�d|jkr,td�t|j�|j���dS)N�zInvalid IV size ({}) for {}.)�lenr�
block_sizer#�formatrr
rrr
�_check_iv_lengthCs��r))rrcCs*t|�d|jkr&td�t|�|���dS)Nr%zInvalid nonce size ({}) for {}.)r&r'r#r()rrrrrr
�_check_nonce_lengthLs�r*cCst||�t||�dS�N)r$r)r
rrr
�_check_iv_and_key_lengthSs
r,c@s,eZdZdZed�dd�Ze�d�Ze	Z
dS)�CBC�rcCst�d|�||_dS�Nr�r�_check_byteslike�_initialization_vector�r	rrrr
�__init__[szCBC.__init__r2N�rrrrrr4r�read_only_propertyrr,rrrrr
r-Xs
r-c@s6eZdZdZed�dd�Ze�d�Ze	d�dd�Z
dS)	�XTS)rcCs*t�d|�t|�dkr td��||_dS)Nr�z!tweak must be 128-bits (16 bytes))rr1r&r#�_tweak)r	rrrr
r4fszXTS.__init__r9�rcCs|jdkrtd��dS)N)r iz\The XTS specification requires a 256-bit key for AES-128-XTS and 512-bit key for AES-256-XTS)r"r#r
rrr
rps
�zXTS.validate_for_algorithmN)rrrrrr4rr6rrrrrrr
r7cs
r7c@seZdZdZeZdS)�ECBN)rrrrr$rrrrr
r;xsr;c@s,eZdZdZed�dd�Ze�d�Ze	Z
dS)�OFBr.cCst�d|�||_dSr/r0r3rrr
r4�szOFB.__init__r2Nr5rrrr
r<~s
r<c@s,eZdZdZed�dd�Ze�d�Ze	Z
dS)�CFBr.cCst�d|�||_dSr/r0r3rrr
r4�szCFB.__init__r2Nr5rrrr
r=�s
r=c@s,eZdZdZed�dd�Ze�d�Ze	Z
dS)�CFB8r.cCst�d|�||_dSr/r0r3rrr
r4�sz
CFB8.__init__r2Nr5rrrr
r>�s
r>c@s6eZdZdZed�dd�Ze�d�Ze	d�dd�Z
dS)	�CTR)rcCst�d|�||_dS)Nr)rr1�_nonce)r	rrrr
r4�szCTR.__init__r@r:cCst||�t|j|j|�dSr+)r$r*rrr
rrr
r�s
zCTR.validate_for_algorithmN)rrrrrr4rr6rrrrrrr
r?�s
r?c@sTeZdZdZdZdZd
eejee	d�dd�Z
e�d�Z
e�d	�Zed
�dd�ZdS)�GCMl��?lNr8)rr�min_tag_lengthcCs�t�d|�t|�dks$t|�dkr,td��||_|dk	rpt�d|�|dkrVtd��t|�|krptd�|���||_||_dS)	Nrr%�zIinitialization_vector must be between 8 and 128 bytes (64 and 1024 bits).r�zmin_tag_length must be >= 4z.Authentication tag must be {} bytes or longer.)	rr1r&r#r2�_check_bytesr(�_tagZ_min_tag_length)r	rrrBrrr
r4�s$���zGCM.__init__rFr2r:cCst||�dSr+)r$r
rrr
r�szGCM.validate_for_algorithm)Nr8)rrrr�_MAX_ENCRYPTED_BYTES�_MAX_AAD_BYTESr�typing�Optional�intr4rr6rrrrrrrr
rA�s��

rA)rrI�cryptographyr�/cryptography.hazmat.primitives._cipheralgorithmr�ABCMetarrrrrr$r)rrr*r,r-r7r;r<r=r>r?rArrrr
�<module>s(