(plain_text: str)
| 36 | |
| 37 | |
| 38 | def aes_encrypt(plain_text: str): |
| 39 | cipher = AES.new(AES_ENCRYPTION_KEY_BYTES, AES.MODE_CBC) |
| 40 | ct_bytes = cipher.encrypt(pad(plain_text.encode(), AES.block_size)) |
| 41 | iv = b64encode(cipher.iv).decode("utf-8") |
| 42 | ct = b64encode(ct_bytes).decode("utf-8") |
| 43 | return f"{iv},{ct}" |
| 44 | |
| 45 | |
| 46 | def aes_decrypt(encrypted_text: str): |