
    ӝgh                       d dl mZ d dlZd dlZd dlmZ d dlmZ d dl	m
Z
 d dl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 ej$                  dej&                  e
j(                     d      Z G d dej*                  e         Zeej.                  e
j0                  e
j2                  e
j4                  e
j6                  df      Zej;                  ej<                  j                         ej;                  ej<                  j"                         ej;                  ej<                  j                          y)    )annotationsN)openssl)CipherAlgorithm)modes)Bufferc                      e Zd Zej                  dd       Zej                  dd       Zej                  dd       Zej                  d	d       Zy)
CipherContextc                     y)zk
        Processes the provided bytes through the cipher and returns the results
        as bytes.
        N selfdatas     o/var/www/enzed_healthcare/enzed_env/lib/python3.12/site-packages/cryptography/hazmat/primitives/ciphers/base.pyupdatezCipherContext.update           c                     y)z
        Processes the provided bytes and writes the resulting data into the
        provided buffer. Returns the number of bytes written.
        Nr   )r   r   bufs      r   update_intozCipherContext.update_into   r   r   c                     y)zM
        Returns the results of processing the final block as bytes.
        Nr   r   s    r   finalizezCipherContext.finalize   r   r   c                     y)z
        Resets the nonce for the cipher context to the provided value.
        Raises an exception if it does not support reset or if the
        provided nonce does not have a valid length.
        Nr   )r   nonces     r   reset_noncezCipherContext.reset_nonce%   r   r   N)r   r   returnbytes)r   r   r   r   r   intr   r   )r   r   r   None)	__name__
__module____qualname__abcabstractmethodr   r   r   r   r   r   r   r	   r	      sh      	  	 
 	 r   r	   )	metaclassc                  2    e Zd Zej                  dd       Zy)AEADCipherContextc                     y)z3
        Authenticates the provided bytes.
        Nr   r   s     r   authenticate_additional_dataz.AEADCipherContext.authenticate_additional_data/   r   r   N)r   r   r   r    )r!   r"   r#   r$   r%   r*   r   r   r   r(   r(   .   s     r   r(   c                  2    e Zd Zej                  dd       Zy)AEADDecryptionContextc                     y)z
        Returns the results of processing the final block as bytes and allows
        delayed passing of the authentication tag.
        Nr   )r   tags     r   finalize_with_tagz'AEADDecryptionContext.finalize_with_tag7   r   r   N)r.   r   r   r   )r!   r"   r#   r$   r%   r/   r   r   r   r,   r,   6   s     r   r,   c                  <    e Zd Zeej
                  dd              Zy)AEADEncryptionContextc                     y)zb
        Returns tag bytes. This is only available after encryption is
        finalized.
        Nr   r   s    r   r.   zAEADEncryptionContext.tag@   r   r   Nr   )r!   r"   r#   propertyr$   r%   r.   r   r   r   r1   r1   ?   s"      r   r1   ModeT)bound	covariantc                      e Zd Z	 d		 	 	 	 	 	 	 d
dZej
                  	 	 	 	 dd       Zej
                  	 	 	 	 dd       Zd Zej
                  	 	 	 	 dd       Zej
                  	 	 	 	 dd       Zd Zy)CipherNc                    t        |t              st        d      |-t        |t        j                        sJ |j                  |       || _        || _        y )Nz&Expected interface of CipherAlgorithm.)
isinstancer   	TypeErrorr   r4   validate_for_algorithm	algorithmmode)r   r=   r>   backends       r   __init__zCipher.__init__O   sR     )_5DEE dEJJ///''	2"	r   c                     y Nr   r   s    r   	encryptorzCipher.encryptora        !$r   c                     y rB   r   r   s    r   rC   zCipher.encryptorf        r   c                    t        | j                  t        j                        r!| j                  j                  t        d      t        j                  j                  | j                  | j                        S )Nz0Authentication tag must be None when encrypting.)
r:   r>   r   ModeWithAuthenticationTagr.   
ValueErrorrust_opensslcipherscreate_encryption_ctxr=   r   s    r   rC   zCipher.encryptork   s\    dii!@!@Ayy}}( F  ##99NNDII
 	
r   c                     y rB   r   r   s    r   	decryptorzCipher.decryptorv   rD   r   c                     y rB   r   r   s    r   rN   zCipher.decryptor{   rF   r   c                j    t         j                  j                  | j                  | j                        S rB   )rJ   rK   create_decryption_ctxr=   r>   r   s    r   rN   zCipher.decryptor   s(    ##99NNDII
 	
r   rB   )r=   r   r>   r4   r?   z
typing.Anyr   r    )r   'Cipher[modes.ModeWithAuthenticationTag]r   r1   )r   _CIPHER_TYPEr   r	   )r   rR   r   r,   )r!   r"   r#   r@   typingoverloadrC   rN   r   r   r   r8   r8   N   s    
 #	"  	
 
$ __$5$	$ $ __	 	
 __$5$	$ $ __	 
r   r8   )
__future__r   r$   rT   "cryptography.hazmat.bindings._rustr   rJ   /cryptography.hazmat.primitives._cipheralgorithmr   &cryptography.hazmat.primitives.ciphersr   cryptography.utilsr   ABCMetar	   r(   r,   r1   TypeVarOptionalr4   Genericr8   UnionModeWithNonceModeWithTweakECBModeWithInitializationVectorrS   registerrK   r   r   r   <module>re      s2  
 # 
  F K 8 %ckk < - -  v~~
&//%**-
5
V^^D! 5
p 
LL		**		   |++99 :   |33II J   |33II Jr   