관리-도구
편집 파일: _mode_cbc.cpython-311.pyc
� O�Dg�* � � � d Z dgZddlmZ ddlmZmZmZmZm Z m Z mZmZ ddl mZ edd� � Z G d� de� � Zd � Zd S )z' Ciphertext Block Chaining (CBC) mode. �CbcMode� )�_copy_bytes)�load_pycryptodome_raw_lib�VoidPointer�create_string_buffer�get_raw_buffer�SmartPointer�c_size_t�c_uint8_ptr�is_writeable_buffer)�get_random_byteszCrypto.Cipher._raw_cbca� int CBC_start_operation(void *cipher, const uint8_t iv[], size_t iv_len, void **pResult); int CBC_encrypt(void *cbcState, const uint8_t *in, uint8_t *out, size_t data_len); int CBC_decrypt(void *cbcState, const uint8_t *in, uint8_t *out, size_t data_len); int CBC_stop_operation(void *state); c �( � e Zd ZdZd� Zdd�Zdd�ZdS )r a[ *Cipher-Block Chaining (CBC)*. Each of the ciphertext blocks depends on the current and all previous plaintext blocks. An Initialization Vector (*IV*) is required. See `NIST SP800-38A`_ , Section 6.2 . .. _`NIST SP800-38A` : http://csrc.nist.gov/publications/nistpubs/800-38a/sp800-38a.pdf :undocumented: __init__ c �F � t � � | _ t � |� � � t |� � t t |� � � � | j � � � � � }|rt d|z � � �t | j � � � t j � � | _ |� � � t |� � | _ t dd|� � | _ | j | _ ddg| _ dS )a Create a new block cipher, configured in CBC mode. :Parameters: block_cipher : C pointer A smart pointer to the low-level block cipher instance. iv : bytes/bytearray/memoryview The initialization vector to use for encryption or decryption. It is as long as the cipher block. **The IV must be unpredictable**. Ideally it is picked randomly. Reusing the *IV* for encryptions performed with the same key compromises confidentiality. z)Error %d while instantiating the CBC modeN�encrypt�decrypt)r �_state�raw_cbc_lib�CBC_start_operation�getr r �len� address_of� ValueErrorr �CBC_stop_operation�release� block_sizer �iv�IV�_next)�self�block_cipherr �results �y/builddir/build/BUILD/imunify360-venv-2.4.0/opt/imunify360/venv/lib64/python3.11/site-packages/Crypto/Cipher/_mode_cbc.py�__init__zCbcMode.__init__N s � �"