From 281c47f3e0998527c22aaf66017b606b91cda5f7 Mon Sep 17 00:00:00 2001 From: Mark Qvist Date: Thu, 27 Aug 2026 13:12:04 +0200 Subject: [PATCH] Fixed invalid reference in exception description --- RNS/Cryptography/AES.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/RNS/Cryptography/AES.py b/RNS/Cryptography/AES.py index 9025ab77..c2b93665 100644 --- a/RNS/Cryptography/AES.py +++ b/RNS/Cryptography/AES.py @@ -43,7 +43,7 @@ elif cp.PROVIDER == cp.PROVIDER_PYCA: class AES_128_CBC: @staticmethod def encrypt(plaintext, key, iv): - if len(key) != 16: raise ValueError(f"Invalid key length {len(key)*8} for {self}") + if len(key) != 16: raise ValueError(f"Invalid key length {len(key)*8} for AES_128_CBC") if cp.PROVIDER == cp.PROVIDER_INTERNAL: cipher = AES128(key) return cipher.encrypt(plaintext, iv) @@ -60,7 +60,7 @@ class AES_128_CBC: @staticmethod def decrypt(ciphertext, key, iv): - if len(key) != 16: raise ValueError(f"Invalid key length {len(key)*8} for {self}") + if len(key) != 16: raise ValueError(f"Invalid key length {len(key)*8} for AES_128_CBC") if cp.PROVIDER == cp.PROVIDER_INTERNAL: cipher = AES128(key) return cipher.decrypt(ciphertext, iv) @@ -78,7 +78,7 @@ class AES_128_CBC: class AES_256_CBC: @staticmethod def encrypt(plaintext, key, iv): - if len(key) != 32: raise ValueError(f"Invalid key length {len(key)*8} for {self}") + if len(key) != 32: raise ValueError(f"Invalid key length {len(key)*8} for AES_256_CBC") if cp.PROVIDER == cp.PROVIDER_INTERNAL: cipher = AES256(key) return cipher.encrypt_cbc(plaintext, iv) @@ -95,7 +95,7 @@ class AES_256_CBC: @staticmethod def decrypt(ciphertext, key, iv): - if len(key) != 32: raise ValueError(f"Invalid key length {len(key)*8} for {self}") + if len(key) != 32: raise ValueError(f"Invalid key length {len(key)*8} for AES_256_CBC") if cp.PROVIDER == cp.PROVIDER_INTERNAL: cipher = AES256(key) return cipher.decrypt_cbc(ciphertext, iv)