MCPcopy Create free account
hub / github.com/TaskingAI/TaskingAI / aes_decrypt

Function aes_decrypt

backend/tkhelper/encryption/aes.py:24–34  ·  view source on GitHub ↗
(encrypted_text: str)

Source from the content-addressed store, hash-verified

22
23
24def aes_decrypt(encrypted_text: str):
25 if not AES_ENCRYPTION_KEY_BYTES:
26 raise Exception("AES_ENCRYPTION_KEY is not set")
27 if encrypted_text is None or "," not in encrypted_text:
28 return None
29 iv, ct = encrypted_text.split(",", 1)
30 iv = b64decode(iv)
31 ct = b64decode(ct)
32 cipher = AES.new(AES_ENCRYPTION_KEY_BYTES, AES.MODE_CBC, iv)
33 pt = unpad(cipher.decrypt(ct), AES.block_size)
34 return pt.decode("utf-8")
35
36
37def generate_aes_encryption_key():

Callers 2

buildMethod · 0.90
decryptMethod · 0.90

Calls 2

decryptMethod · 0.45
decodeMethod · 0.45

Tested by

no test coverage detected