1 """Abstract class for AES."""
4 def __init__(self, key, mode, IV, implementation):
5 if len(key) not in (16, 24, 32):
10 raise AssertionError()
11 self.isBlockCipher = True
13 self.implementation = implementation
21 raise AssertionError()
23 #CBC-Mode encryption, returns ciphertext
24 #WARNING: *MAY* modify the input as well
25 def encrypt(self, plaintext):
26 assert(len(plaintext) % 16 == 0)
28 #CBC-Mode decryption, returns plaintext
29 #WARNING: *MAY* modify the input as well
30 def decrypt(self, ciphertext):
31 assert(len(ciphertext) % 16 == 0)