home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / var / lib / python-support / python2.6 / gdata / tlslite / utils / AES.pyc (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2009-04-20  |  1.4 KB  |  42 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. '''Abstract class for AES.'''
  5.  
  6. class AES:
  7.     
  8.     def __init__(self, key, mode, IV, implementation):
  9.         if len(key) not in (16, 24, 32):
  10.             raise AssertionError()
  11.         len(key) not in (16, 24, 32)
  12.         if mode != 2:
  13.             raise AssertionError()
  14.         mode != 2
  15.         if len(IV) != 16:
  16.             raise AssertionError()
  17.         len(IV) != 16
  18.         self.isBlockCipher = True
  19.         self.block_size = 16
  20.         self.implementation = implementation
  21.         if len(key) == 16:
  22.             self.name = 'aes128'
  23.         elif len(key) == 24:
  24.             self.name = 'aes192'
  25.         elif len(key) == 32:
  26.             self.name = 'aes256'
  27.         else:
  28.             raise AssertionError()
  29.         return len(key) == 16
  30.  
  31.     
  32.     def encrypt(self, plaintext):
  33.         if not len(plaintext) % 16 == 0:
  34.             raise AssertionError
  35.  
  36.     
  37.     def decrypt(self, ciphertext):
  38.         if not len(ciphertext) % 16 == 0:
  39.             raise AssertionError
  40.  
  41.  
  42.