def aes_encrypt(key, iv, plaintext):
""" Use AES128 GCM with the given key and iv to encrypt the plaintext. """
backend = default_backend()
encryptor = Cipher(
algorithms.AES(key),
GCM(iv),
backend=backend).encryptor()
return encryptor.update(plaintext) + encryptor.finalize() + encryptor.tag
评论列表
文章目录