跳到主要内容
uencoder

Use AES 在 GCM 模式为 已认证加密

AES-GCM provides 两者保密性和 完整性在 单个操作, detecting tampering 无 separate HMAC. 它是 recommended AES 模式为 最多 applications.

  1. 1

    GCM (Galois/Counter Mode) combines AES-CTR 为加密具有 GHASH 为认证. 它 produces ciphertext plus 16-字节认证 tag. 如果 tag 不验证开 解密, 数据是 tampered 具有和 必须是 已拒绝. 从不 use AES-CTR alone 无认证.

  2. 2
    AES 加密器 →

    加密 data with AES to produce ciphertext. In GCM mode, this also generates an authentication tag that must be stored alongside the ciphertext.

  3. 3
    AES 解密器 →

    解密 with the same key and verify the authentication tag. If verification fails, the ciphertext was modified in transit — reject it without decrypting.

  4. 4

    GCM requirements: 唯一 96-位 nonce per 加密 (从不 reuse 具有相同键), 128-位认证 tag 必须是 verified 之前 trusting plaintext. GCM 是 parallelizable 和 hardware-accelerated (AES-NI), making 它 fastest 已认证模式开 现代 CPUs.

常见问题

什么 happens 如果 I reuse GCM nonce?
Nonce reuse 在 GCM 是 catastrophic — 它 leaks 认证键 (H) 和 allows forgery 的有效 tags. 此是 worse than nonce reuse 在 CTR 模式. Use counter-based 或 random nonce 和从不 repeat 它.
GCM vs CBC+HMAC?
GCM 是 faster (单个通过, parallelizable, hardware-accelerated) 和 produces shorter tag. CBC+HMAC 是 two passes 但不 有 nonce-reuse catastrophic 失败. 为最多新 systems, use GCM.

解决此任务的工作流

相关工具