AES.py¶
Provides a wrapper class on top of the AES implementation in Crypto which handles creating the IV and padding.
Class definitions:
-
class
core.encryption.AES.AES_256_CBC[source]¶ Class for AES_256_CBC encryption
-
encrypt(plain_text, key)[source]¶ Encrypt plaintext with AES 256 CBC (32 bytes) by using the key into a base64 string including the random iv_bytes.
- Args:
- plain_text: the text to encrypt
- key: the key to use for encryption
The IV is prepended to the encrypted bytes
The actual used key is the key hashed using SHA256
- Returns:
- IV + plain_text_encrypted_with_key in base64 format
-
decrypt(base64_AES_256_CBC_encrypted_text, key)[source]¶ decrypt base64_AES_256_CBC_encrypted_text with AES 256 CBC (32 bytes) by using the key
- Args:
- base64_AES_256_CBC_encrypted_text: the encrypted value with the IV prepended.
- key: the key to use for encryption
The actual used key is the key hashed using SHA256
- Returns:
- plain_text
-