singe/thirdparty/openssl/tlslite-ng/tlslite/utils/pycrypto_aesgcm.py
2023-11-16 22:15:24 -06:00

16 lines
446 B
Python

# Author: Google
# See the LICENSE file for legal information regarding use of this file.
"""PyCrypto AES-GCM implementation."""
from .cryptomath import *
from .aesgcm import AESGCM
if pycryptoLoaded:
import Crypto.Cipher.AES
def new(key):
cipher = Crypto.Cipher.AES.new(bytes(key))
def encrypt(plaintext):
return bytearray(cipher.encrypt(bytes(plaintext)))
return AESGCM(key, "pycrypto", encrypt)