
    .Ph                       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
j        e
j        e
j        e
j        df                  Ze                    ej        j                   e                    ej        j                   e                    ej        j                   dS )    )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dS )CipherContextdatar   returnbytesc                    dS )zk
        Processes the provided bytes through the cipher and returns the results
        as bytes.
        N selfr
   s     k/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/cryptography/hazmat/primitives/ciphers/base.pyupdatezCipherContext.update             bufintc                    dS )z
        Processes the provided bytes and writes the resulting data into the
        provided buffer. Returns the number of bytes written.
        Nr   )r   r
   r   s      r   update_intozCipherContext.update_into   r   r   c                    dS )zM
        Returns the results of processing the final block as bytes.
        Nr   r   s    r   finalizezCipherContext.finalize   r   r   nonceNonec                    dS )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   r   s     r   reset_noncezCipherContext.reset_nonce%   r   r   N)r
   r   r   r   )r
   r   r   r   r   r   r   r   )r   r   r   r   )	__name__
__module____qualname__abcabstractmethodr   r   r   r   r   r   r   r	   r	      s            	    	   
 	     r   r	   )	metaclassc                  0    e Zd Zej        dd            ZdS )AEADCipherContextr
   r   r   r   c                    dS )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(   .   s6             r   r(   c                  0    e Zd Zej        dd            ZdS )AEADDecryptionContexttagr   r   c                    dS )z
        Returns the results of processing the final block as bytes and allows
        delayed passing of the authentication tag.
        Nr   )r   r-   s     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   s6             r   r,   c                  @    e Zd Zeej        dd                        ZdS )AEADEncryptionContextr   r   c                    dS )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@            X  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dS )CipherN	algorithmr   moder4   backend
typing.Anyr   r   c                    t          |t                    st          d          |1t          |t          j                  sJ |                    |           || _        || _        d S )Nz&Expected interface of CipherAlgorithm.)
isinstancer   	TypeErrorr   r4   validate_for_algorithmr9   r:   )r   r9   r:   r;   s       r   __init__zCipher.__init__O   sl     )_55 	FDEEE dEJ/////''	222"			r   r   'Cipher[modes.ModeWithAuthenticationTag]r1   c                    d S Nr   r   s    r   	encryptorzCipher.encryptora   	     !$r   _CIPHER_TYPEr	   c                    d S rD   r   r   s    r   rE   zCipher.encryptorf   	     r   c                    t          | j        t          j                  r| j        j        t          d          t          j                            | j	        | j                  S )Nz0Authentication tag must be None when encrypting.)
r>   r:   r   ModeWithAuthenticationTagr-   
ValueErrorrust_opensslcipherscreate_encryption_ctxr9   r   s    r   rE   zCipher.encryptork   s^    di!@AA 	y}( F   #99NDI
 
 	
r   r,   c                    d S rD   r   r   s    r   	decryptorzCipher.decryptorv   rF   r   c                    d S rD   r   r   s    r   rQ   zCipher.decryptor{   rI   r   c                V    t           j                            | j        | j                  S rD   )rM   rN   create_decryption_ctxr9   r:   r   s    r   rQ   zCipher.decryptor   s&    #99NDI
 
 	
r   rD   )r9   r   r:   r4   r;   r<   r   r   )r   rB   r   r1   )r   rG   r   r	   )r   rB   r   r,   )r!   r"   r#   rA   typingoverloadrE   rQ   r   r   r   r8   r8   N   s        
 #	    $ _$ $ $ _$ _   _	
 	
 	
 _$ $ $ _$ _   _
 
 
 
 
r   r8   )
__future__r   r$   rU   "cryptography.hazmat.bindings._rustr   rM   /cryptography.hazmat.primitives._cipheralgorithmr   &cryptography.hazmat.primitives.ciphersr   cryptography.utilsr   ABCMetar	   r(   r,   r1   TypeVarOptionalr4   Genericr8   UnionModeWithNonceModeWithTweakECBModeWithInitializationVectorrG   registerrN   r   r   r   <module>rf      s&  
 # " " " " " 



  F F F F F F K K K K K K 8 8 8 8 8 8 % % % % % %    ck    <            -        -     v~
&/%*-  
5
 5
 5
 5
 5
V^D! 5
 5
 5
p 
L	*		   |+9 : : :   |3I J J J   |3I J J J J Jr   