
    tfs                    v   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
  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        de
j        e
j        f                  Ze                    ej        j                   e                    ej        j                   e                    ej        j                   dS )    )annotationsN)openssl)CipherAlgorithm)modesc                      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databytesreturnc                    dS )zk
        Processes the provided bytes through the cipher and returns the results
        as bytes.
        N selfr	   s     j/var/www/surfInsights/venv3-11/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_tag6   r   r   N)r,   r
   r   r
   )r    r!   r"   r#   r$   r.   r   r   r   r+   r+   5   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   r0   r0   >   s@            X  r   r0   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   moder3   backend
typing.Anyr   r   c                    t          |t                    st          d          |1t          |t          j                  sJ |                    |           || _        || _        d S )Nz&Expected interface of CipherAlgorithm.)
isinstancer   	TypeErrorr   r3   validate_for_algorithmr8   r9   )r   r8   r9   r:   s       r   __init__zCipher.__init__N   sl     )_55 	FDEEE dEJ/////''	222"			r   r   'Cipher[modes.ModeWithAuthenticationTag]r0   c                    d S Nr   r   s    r   	encryptorzCipher.encryptor`   	     !$r   _CIPHER_TYPEr   c                    d S rC   r   r   s    r   rD   zCipher.encryptore   	     r   c                    t          | j        t          j                  r| j        j        t          d          t          j                            | j	        | j                  S )Nz0Authentication tag must be None when encrypting.)
r=   r9   r   ModeWithAuthenticationTagr,   
ValueErrorrust_opensslcipherscreate_encryption_ctxr8   r   s    r   rD   zCipher.encryptorj   s^    di!@AA 	y}( F   #99NDI
 
 	
r   r+   c                    d S rC   r   r   s    r   	decryptorzCipher.decryptoru   rE   r   c                    d S rC   r   r   s    r   rP   zCipher.decryptorz   rH   r   c                V    t           j                            | j        | j                  S rC   )rL   rM   create_decryption_ctxr8   r9   r   s    r   rP   zCipher.decryptor   s&    #99NDI
 
 	
r   rC   )r8   r   r9   r3   r:   r;   r   r   )r   rA   r   r0   )r   rF   r   r   )r   rA   r   r+   )r    r!   r"   r@   typingoverloadrD   rP   r   r   r   r7   r7   M   s        
 #	    $ _$ $ $ _$ _   _	
 	
 	
 _$ $ $ _$ _   _
 
 
 
 
r   r7   )
__future__r   r#   rT   "cryptography.hazmat.bindings._rustr   rL   /cryptography.hazmat.primitives._cipheralgorithmr   &cryptography.hazmat.primitives.ciphersr   ABCMetar   r'   r+   r0   TypeVarOptionalr3   Genericr7   UnionModeWithNonceModeWithTweakECBModeWithInitializationVectorrF   registerrM   r   r   r   <module>rd      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   