Symmetric Encryption Utilities
decrypt_aes_cbc(ciphertext, key, iv, base64_decode=False, as_str=False, warn_mode=WarnEnum.DEBUG)
Decrypts a ciphertext using AES-CBC key and iv.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ciphertext
|
(str | bytes, required)
|
The ciphertext to decrypt. |
required |
key
|
(bytes, required)
|
The key to use for decryption. |
required |
iv
|
(bytes, required)
|
The initialization vector to use for decryption. |
required |
base64_decode
|
bool
|
Whether to decode the ciphertext from base64. Defaults to False. |
False
|
as_str
|
bool
|
Whether to return the plaintext as a string or bytes. Defaults to False. |
False
|
warn_mode
|
WarnEnum
|
The warning mode to use. Defaults to WarnEnum.DEBUG. |
DEBUG
|
Raises:
| Type | Description |
|---|---|
Exception
|
If failed to decrypt ciphertext using AES-CBC key and iv for any reason. |
Returns:
| Type | Description |
|---|---|
str | bytes
|
str | bytes: The decrypted plaintext as a string or bytes. |