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__/base.cpython-312.pyc
�

�)%a���r�ddlZddlZddlmZddlmZmZmZmZm	Z	ddl
mZddlm
Z
ddlmZddlmZGd�d	ej$�
�ZGd�dej$�
�ZGd
�dej$�
�ZGd�dej$�
�ZGd�dej$�
�ZGd�de�Zej4e�Gd�de��Zej4e�ej4e�ej4e�Gd�de����Zej4e�Gd�de��Zy)�N)�utils)�AlreadyFinalized�AlreadyUpdated�NotYetFinalized�UnsupportedAlgorithm�_Reasons)�_get_backend)�
CipherBackend)�CipherAlgorithm)�modesc�6�eZdZejdefd��Zy)�BlockCipherAlgorithm�returnc��y)zK
        The size of a block as an integer in bits (e.g. 64, 128).
        N���selfs �M/usr/lib/python3/dist-packages/cryptography/hazmat/primitives/ciphers/base.py�
block_sizezBlockCipherAlgorithm.block_size���N)�__name__�
__module__�__qualname__�abc�abstractproperty�intrrrrrrs!������C���rr)�	metaclassc��eZdZejdedefd��Zejdedefd��Zejdefd��Z	y)�
CipherContext�datarc��y)zk
        Processes the provided bytes through the cipher and returns the results
        as bytes.
        Nr�rr!s  r�updatezCipherContext.update rrc��y)z�
        Processes the provided bytes and writes the resulting data into the
        provided buffer. Returns the number of bytes written.
        Nr�rr!�bufs   r�update_intozCipherContext.update_into'rrc��y)zM
        Returns the results of processing the final block as bytes.
        Nrrs r�finalizezCipherContext.finalize.rrN)
rrrr�abstractmethod�bytesr$rr(r*rrrr r sq������5��U����	������s����	����%���rr c�:�eZdZejdeddfd��Zy)�AEADCipherContextr!rNc��y)z3
        Authenticates the provided bytes.
        Nrr#s  r�authenticate_additional_dataz.AEADCipherContext.authenticate_additional_data6rr)rrrrr+r,r0rrrr.r.5s(��������4���rr.c�:�eZdZejdedefd��Zy)�AEADDecryptionContext�tagrc��y)z�
        Returns the results of processing the final block as bytes and allows
        delayed passing of the authentication tag.
        Nr)rr3s  r�finalize_with_tagz'AEADDecryptionContext.finalize_with_tag>rrN)rrrrr+r,r5rrrr2r2=s(������U��u���rr2c�6�eZdZejdefd��Zy)�AEADEncryptionContextrc��y)zb
        Returns tag bytes. This is only available after encryption is
        finalized.
        Nrrs rr3zAEADEncryptionContext.tagGrrN)rrrrrr,r3rrrr7r7Fs!������U���rr7c�`�eZdZ	ddedej
ejfd�Zd�Z	d�Z
d�Zy)	�CipherN�	algorithm�modec���t|�}t|t�stdtj
��t|t�std��|�|j|�||_	||_
||_y)Nz0Backend object does not implement CipherBackend.z&Expected interface of CipherAlgorithm.)r	�
isinstancer
rr�BACKEND_MISSING_INTERFACEr�	TypeError�validate_for_algorithmr;r<�_backend)rr;r<�backends    r�__init__zCipher.__init__Psr���w�'���'�=�1�&�B��2�2��
�
�)�_�5��D�E�E����'�'�	�2�"�����	���
rc��t|jtj�r!|jj�td��|jj|j|j�}|j|d��S)Nz0Authentication tag must be None when encrypting.T��encrypt)
r>r<r�ModeWithAuthenticationTagr3�
ValueErrorrB�create_symmetric_encryption_ctxr;�	_wrap_ctx�r�ctxs  r�	encryptorzCipher.encryptorgsl���d�i�i��!@�!@�A��y�y�}�}�(� �F����m�m�;�;��N�N�D�I�I�
���~�~�c�4�~�0�0rc��|jj|j|j�}|j	|d��S)NFrF)rB�create_symmetric_decryption_ctxr;r<rKrLs  r�	decryptorzCipher.decryptorrs8���m�m�;�;��N�N�D�I�I�
���~�~�c�5�~�1�1rc��t|jtj�r|rt	|�St|�St
|�S�N)r>r<rrH�_AEADEncryptionContext�_AEADCipherContext�_CipherContext)rrMrGs   rrKzCipher._wrap_ctxxs:���d�i�i��!@�!@�A��-�c�2�2�)�#�.�.�!�#�&�&rrS)rrrr�typing�Optionalr�ModerDrNrQrKrrrr:r:Os:��
�	 �"� ��o�o�e�j�j�)� �.	1�2�'rr:c�>�eZdZd�Zdedefd�Zdedefd�Zdefd�Zy)rVc��||_yrS)�_ctxrLs  rrDz_CipherContext.__init__�s	����	rr!rc�f�|j�td��|jj|�S�N�Context was already finalized.)r\rr$r#s  rr$z_CipherContext.update�s-���9�9��"�#C�D�D��y�y����%�%rc�h�|j�td��|jj||�Sr^)r\rr(r&s   rr(z_CipherContext.update_into�s/���9�9��"�#C�D�D��y�y�$�$�T�3�/�/rc�v�|j�td��|jj�}d|_|Sr^)r\rr*r#s  rr*z_CipherContext.finalize�s6���9�9��"�#C�D�D��y�y�!�!�#����	��rN)	rrrrDr,r$rr(r*rrrrVrV�s9���&�5�&�U�&�
0��0�s�0�
�%�rrVc�j�eZdZd�Zdefd�Zdedefd�Zdedefd�Zdefd�Z	d	edefd
�Z
deddfd�Zy)
rUc�J�||_d|_d|_d|_d|_y)NrF)r\�_bytes_processed�_aad_bytes_processed�_tag�_updatedrLs  rrDz_AEADCipherContext.__init__�s'����	� !���$%��!���	���
r�	data_sizec�r�|j�td��d|_|xj|z
c_|j|jjj
kDrWt
dj|jjj|jjj
���y)Nr_Tz+{} has a maximum encrypted byte limit of {})	r\rrgrd�_mode�_MAX_ENCRYPTED_BYTESrI�format�name)rrhs  r�_check_limitz_AEADCipherContext._check_limit�s����9�9��"�#C�D�D���
�����*��� � �4�9�9�?�?�#G�#G�G��=�D�D��I�I�O�O�(�(�$�)�)�/�/�*N�*N���
�Hrr!rc�l�|jt|��|jj|�SrS)rn�lenr\r$r#s  rr$z_AEADCipherContext.update�s)�����#�d�)�$��y�y����%�%rc�n�|jt|��|jj||�SrS)rnrpr\r(r&s   rr(z_AEADCipherContext.update_into�s+�����#�d�)�$��y�y�$�$�T�3�/�/rc��|j�td��|jj�}|jj|_d|_|Sr^)r\rr*r3rfr#s  rr*z_AEADCipherContext.finalize�sE���9�9��"�#C�D�D��y�y�!�!�#���I�I�M�M��	���	��rr3c��|j�td��|jj|�}|jj|_d|_|Sr^)r\rr5r3rf)rr3r!s   rr5z$_AEADCipherContext.finalize_with_tag�sG���9�9��"�#C�D�D��y�y�*�*�3�/���I�I�M�M��	���	��rNc���|j�td��|jrtd��|xjt|�z
c_|j|jjjkDrWtdj|jjj|jjj���|jj|�y)Nr_z'Update has been called on this context.z%{} has a maximum AAD byte limit of {})r\rrgrrerprj�_MAX_AAD_BYTESrIrlrmr0r#s  rr0z/_AEADCipherContext.authenticate_additional_data�s����9�9��"�#C�D�D��=�=� �!J�K�K��!�!�S��Y�.�!��$�$�t�y�y���'E�'E�E��7�>�>��I�I�O�O�(�(�$�)�)�/�/�*H�*H���
�	
�	�	�.�.�t�4r)rrrrDrrnr,r$r(r*r5r0rrrrUrU�sk���
�c�
�&�5�&�U�&�0��0�s�0��%���U��u��5��5�4�5rrUc�"�eZdZedefd��Zy)rTrc�d�|j�td��|j�J�|jS)Nz4You must finalize encryption before getting the tag.)r\rrfrs rr3z_AEADEncryptionContext.tag�s8���9�9� �!�I��
��y�y�$�$�$��y�y�rN)rrr�propertyr,r3rrrrTrT�s��
��U���rrT)rrW�cryptographyr�cryptography.exceptionsrrrrr�cryptography.hazmat.backendsr	�'cryptography.hazmat.backends.interfacesr
�/cryptography.hazmat.primitives._cipheralgorithmr�&cryptography.hazmat.primitives.ciphersr�ABCMetarr r.r2r7�objectr:�register_interfacerVrUrTrrr�<module>r�s,���
����6�A�K�8��S�[�[���c�k�k��,�#�+�+���c�k�k���c�k�k��0'�V�0'�f����-�(��V��)��,����+�,�����-�(�����/�0�:5��:5�1�)�-�:5�z����/�0��/��1�r