HEX
Server: LiteSpeed
System: Linux php-prod-1.spaceapp.ru 5.15.0-157-generic #167-Ubuntu SMP Wed Sep 17 21:35:53 UTC 2025 x86_64
User: xnsbb3110 (1041)
PHP: 8.1.33
Disabled: NONE
Upload Files
File: //usr/local/CyberCP/lib/python3.10/site-packages/asyncssh/crypto/__pycache__/cipher.cpython-310.pyc
o

�h��@sUdZddlmZddlmZmZmZmZddlZddl	m
Z
ddlmZm
Z
ddlmZddlmZmZddlmmmmZeeed	<zddlmmmmZWneyfdZYnweeeefZeeeefZ d
Z!iZ"ee#efed<iZ$ee#e fed<Gd
d�d�Z%Gdd�d�Z&de#dedededdf
dd�Z'de#de fdd�Z(ddedd
d
d
fddeddd
d
fddeddd
d
fd dedd
d
d
fd!deddd
d
fd"deddd
d
fd#d$d%d&d'd(d)d*edd
d+d+fd,d-edd
d+d+fd.d/edd+d+d+fd0d/edd
d+d+fd1d/eddd+d+fd2d3edd
d
d
ffZ)e�*��`e�+d4�e)D]O\Z,Z-Z.Z/Z0Z1Z2e-�rcze3ee-�Z4Wn,e5�ybZ6ze�rWze3ee-�Z4Wne5�yVe6d�w�WYdZ6[6ndZ6[6wwdZ4e4e.e/fe"e,<e'e,e0e1e2��q%Wd�dS1�s�wYdS)5zEA shim around PyCA for accessing symmetric ciphers needed by AsyncSSH�)�
ModuleType)�Any�MutableMapping�Optional�TupleN)�
InvalidTag)�Cipher�
CipherContext)�AESGCM)�CBC�CTR�_decrepit_algs��_cipher_algs�_cipher_paramsc@sJeZdZdZdededefdd�Zdedefd	d
�Zdedefdd�Zd
S)�BasicCipherzShim for basic ciphers�cipher_name�key�ivcCs@t|\}}}t||�|r||�nd�|_||_d|_d|_dS)N)rr�_cipher�_initial_bytes�
_encryptor�
_decryptor)�selfrrr�cipher�mode�
initial_bytes�r�I/usr/local/CyberCP/lib/python3.10/site-packages/asyncssh/crypto/cipher.py�__init__7s

zBasicCipher.__init__�data�returncC�R|js|j��|_|jr|jdusJ�|j�|jd�|jdus#J�|j�|�S)zEncrypt a block of dataN�)rr�	encryptorr�update�rr rrr�encrypt?�zBasicCipher.encryptcCr")zDecrypt a block of dataNr#)rr�	decryptorrr%r&rrr�decryptLr(zBasicCipher.decryptN)	�__name__�
__module__�__qualname__�__doc__�str�bytesrr'r*rrrrr4s

rc	@sleZdZdZdededefdd�Zdd	d
�Zdededeeeffd
d�Z	dededede
efdd�ZdS)�	GCMCipherzShim for GCM ciphersrrrcCst|d|_||_||_dS)Nr)rr�_key�_iv)rrrrrrrr]s
zGCMCipher.__init__r!NcCsBt�|jdd�d�}|dd@}|jdd�|�dd�|_dS)z2Update the IV after each encrypt/decrypt operation�N�big�l�����)�int�
from_bytesr3�to_bytes)r�
invocationrrr�
_update_ivbs zGCMCipher._update_iv�headerr cCs>t|j��|j||�}|��||dt�|td�fS)z Encrypt and sign a block of dataN)r
r2r'r3r<�
_GCM_MAC_SIZE)rr=r rrr�encrypt_and_signis zGCMCipher.encrypt_and_sign�maccCsBzt|j��|j|||�}Wntyd}Ynw|��|S)z3Verify the signature of and decrypt a block of dataN)r
r2r*r3rr<)rr=r r@�decrypted_datarrr�verify_and_decryptss��zGCMCipher.verify_and_decrypt)r!N)r+r,r-r.r/r0rr<rr?rrBrrrrr1Zs
�

�

��r1r�key_size�iv_size�
block_sizer!cCs|||ft|<dS)zRegister a symmetric cipherN�r)rrCrDrErrr�register_cipher�srGcCst|S)z$Get parameters of a symmetric cipherrF)rrrr�get_cipher_params�srHz
aes128-cbc�AESz
aes192-cbc�z
aes256-cbc� z
aes128-ctrz
aes192-ctrz
aes256-ctr)z
aes128-gcmNNrr�r)z
aes256-gcmNNrrKrLr)�arcfour�ARC4Nrrr6r6)�	arcfour40rNNr�r6r6)�
arcfour128rNN�rr6r6)�
arcfour256rNNrRrKr6r6zblowfish-cbc�Blowfishr7zcast128-cbc�CAST5zdes-cbc�	TripleDESzdes2-cbczdes3-cbczseed-cbc�SEED�ignore)7r.�typesr�typingrrrr�warnings�cryptography.exceptionsr�&cryptography.hazmat.primitives.ciphersrr	�+cryptography.hazmat.primitives.ciphers.aeadr
�,cryptography.hazmat.primitives.ciphers.modesrr�1cryptography.hazmat.primitives.ciphers.algorithms�hazmat�
primitives�ciphers�
algorithms�_algs�__annotations__�/cryptography.hazmat.decrepit.ciphers.algorithms�decrepitr
�ImportErrorr8�_CipherAlgs�
_CipherParamsr>rr/rrr1rGrH�_cipher_alg_list�catch_warnings�simplefilter�_cipher_name�_alg�_moder�	_key_size�_iv_size�_block_size�getattrr�AttributeError�excrrrr�<module>s�"�&
(��
��

�����	�$�