: bytes , key: bytes , nonce: bytes , ad: bytes) -> Tuple[ bytes , bytes ]:
"""GCM加密(返回密文和认证标签)""...print(f'原始明文数据: {plaintext.hex()}')
# GCM加密
gcm_ciphertext , tag = aes_gcm_encrypt(plaintext...# GCM解密(原始数据)
gcm_decrypted = aes_gcm_decrypt(gcm_ciphertext , tag , key , nonce , ad)
print...# 解密篡改后的密文 - 应该失败
try:
aes_gcm_decrypt(tampered_gcm_ciphertext , tag , key , nonce , ad)...,则会捕获解密失败的异常。