Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Side by Side Diff: third_party/tlslite/tlslite/utils/AES.py

Issue 211173006: Perform tlslite 0.3.8 -> 0.4.6 renames ahead of time. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Drop the -B Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 """Abstract class for AES."""
2
3 class AES:
4 def __init__(self, key, mode, IV, implementation):
5 if len(key) not in (16, 24, 32):
6 raise AssertionError()
7 if mode != 2:
8 raise AssertionError()
9 if len(IV) != 16:
10 raise AssertionError()
11 self.isBlockCipher = True
12 self.block_size = 16
13 self.implementation = implementation
14 if len(key)==16:
15 self.name = "aes128"
16 elif len(key)==24:
17 self.name = "aes192"
18 elif len(key)==32:
19 self.name = "aes256"
20 else:
21 raise AssertionError()
22
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)
27
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)
OLDNEW
« no previous file with comments | « third_party/tlslite/tlslite/tlsrecordlayer.py ('k') | third_party/tlslite/tlslite/utils/ASN1Parser.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698