
    : j                    6   d dl mZ d dlZd dlmZ d dlmZmZ d dlm	Z	m
Z
  G d dej                  Z G d	 d
eej                  Z G d deej                  Z G d deej                  Z G d deej                  ZddZd dZd!dZd"dZdS )#    )annotationsN)utils)UnsupportedAlgorithm_Reasons)BlockCipherAlgorithmCipherAlgorithmc                  b    e Zd Zeej        d	d                        Zej        d
d            ZdS )Modereturnstrc                    dS )z@
        A string naming this mode (e.g. "ECB", "CBC").
        N selfs    yC:\Users\Terasoftware\OneDrive\Desktop\faahhh\fyndo\fyndo\venv\Lib\site-packages\cryptography/hazmat/primitives/_modes.pynamez	Mode.name             	algorithmr   Nonec                    dS )zq
        Checks that all the necessary invariants of this (mode, algorithm)
        combination are met.
        Nr   r   r   s     r   validate_for_algorithmzMode.validate_for_algorithm   r   r   N)r   r   )r   r   r   r   )__name__
__module____qualname__propertyabcabstractmethodr   r   r   r   r   r
   r
      sd            X
 	     r   r
   )	metaclassc                  @    e Zd Zeej        dd                        ZdS )ModeWithInitializationVectorr   utils.Bufferc                    dS )zP
        The value of the initialization vector for this mode as bytes.
        Nr   r   s    r   initialization_vectorz2ModeWithInitializationVector.initialization_vector"   r   r   Nr   r#   )r   r   r   r   r   r   r%   r   r   r   r"   r"   !   @            X  r   r"   c                  @    e Zd Zeej        dd                        ZdS )ModeWithTweakr   r#   c                    dS )z@
        The value of the tweak for this mode as bytes.
        Nr   r   s    r   tweakzModeWithTweak.tweak+   r   r   Nr&   )r   r   r   r   r   r   r+   r   r   r   r)   r)   *   r'   r   r)   c                  @    e Zd Zeej        dd                        ZdS )ModeWithNoncer   r#   c                    dS )z@
        The value of the nonce for this mode as bytes.
        Nr   r   s    r   noncezModeWithNonce.nonce4   r   r   Nr&   )r   r   r   r   r   r   r/   r   r   r   r-   r-   3   r'   r   r-   c                  @    e Zd Zeej        dd                        ZdS )ModeWithAuthenticationTagr   bytes | Nonec                    dS )zP
        The value of the tag supplied to the constructor of this mode.
        Nr   r   s    r   tagzModeWithAuthenticationTag.tag=   r   r   N)r   r2   )r   r   r   r   r   r   r4   r   r   r   r1   r1   <   r'   r   r1   r   r   r   r   r   c                T    |j         dk    r|j        dk    rt          d          d S d S )N   AESz=Only 128, 192, and 256 bit keys are allowed for this AES mode)key_sizer   
ValueErrorr   s     r   _check_aes_key_lengthr:   E   sI    C 
INe$; 
K
 
 	

 
 
 
r   r   c                    t          | j                  }|dz  |j        k    rt          d| d| j         d          d S )N   zInvalid IV size () for .)lenr%   
block_sizer9   r   )r   r   iv_lens      r   _check_iv_lengthrB   L   sY     +,,FzY)) IGVGG49GGGHHHI Ir   r/   r#   r   r   c                    t          |t                    st          | dt          j                  t          |           dz  |j        k    r#t          dt          |            d| d          d S )N" requires a block cipher algorithmr<   zInvalid nonce size (r=   r>   )
isinstancer   r   r   UNSUPPORTED_CIPHERr?   r@   r9   )r/   r   r   s      r   _check_nonce_lengthrG   T   s     i!566 
"777'
 
 	
 5zzA~-- KIE

II$IIIJJJK Kr   c                    t          |t                    st          |  dt          j                  t          | |           t          | |           d S )NrD   )rE   r   r   r   rF   r:   rB   r   s     r   _check_iv_and_key_lengthrI   `   sc     i!566 
"777'
 
 	
 $	***T9%%%%%r   )r   r
   r   r   r   r   )r   r"   r   r   r   r   )r/   r#   r   r   r   r   r   r   )r   r"   r   r   r   r   )
__future__r   r   cryptographyr   cryptography.exceptionsr   r   /cryptography.hazmat.primitives._cipheralgorithmr   r   ABCMetar
   r"   r)   r-   r1   r:   rB   rG   rI   r   r   r   <module>rO      s  
 # " " " " " 



       B B B B B B B B           S[         43;        DCK        DCK            
 
 
 
I I I I	K 	K 	K 	K	& 	& 	& 	& 	& 	&r   