Package tlslite :: Package utils :: Module pycrypto_aesgcm
[hide private]
[frames] | no frames]

Source Code for Module tlslite.utils.pycrypto_aesgcm

 1  # Author: Google 
 2  # See the LICENSE file for legal information regarding use of this file. 
 3   
 4  """PyCrypto AES-GCM implementation.""" 
 5   
 6  from .cryptomath import * 
 7  from .aesgcm import AESGCM 
 8   
 9  if pycryptoLoaded: 
10      import Crypto.Cipher.AES 
11   
12 - def new(key):
13 cipher = Crypto.Cipher.AES.new(bytes(key)) 14 def encrypt(plaintext): 15 return bytearray(cipher.encrypt(bytes(plaintext)))
16 return AESGCM(key, "pycrypto", encrypt) 17