所有 JWE 都使用经过身份验证的关联数据加密 (AEAD) 算法进行加密。您是否有任何理由不想在附加身份验证数据 (AAD) 中包含 IV 和加密内容加密 key (CEK)?它会以某种方式使 JWE 变得脆弱吗?
编辑:我继续研究这个并根据 RFC 5116 Section 2.1 找到
The nonce is authenticated internally to the algorithm, and it is not necessary to include it in the AD input. The nonce MAY be included in P or A if it is convenient to the application.
和
The secret key K MUST NOT be included in any of the other inputs (N, P, and A). (This restriction does not mean that the values of those inputs must be checked to ensure that they do not include substrings that match the key; instead, it means that the key must not be explicitly copied into those inputs.)
所以我唯一剩下的问题是考虑加密的内容 key 等同于一个随机值是否可以将其也包含在 aad 中?再次完全是为了方便。或者这会不会导致信息泄露?
最佳答案
无需对 IV 或加密内容加密 key (CEK) 进行完整性保护。修改任何一个都会导致解密失败,无论它们是否包含在 AAD 中。然而,到avoid timing oracle attacks实现必须进行整个解密过程,包括解密 CEK、验证 MAC(对于 AES-CBC + HMAC-SHA2 算法)和内容解密。
好的,所以没有必要通过将 IV 或 CEK 包含在 AAD 中来完整性保护它们,但是将它们包含在那里有什么坏处吗?正如您在问题中指出的那样,RFC 5116 表明可以将 IV 包含在 AAD 中,但 CEK 不得包含在包括 AAD 在内的其他算法输入中。但是,假设加密算法是安全的,加密 CEK 在计算上与随机数据无法区分,因此将其包含在 AAD 中应该没问题。
关于authentication - 为什么 JSON Web 加密 (JWE) 不完整性保护 IV 和内容加密 key ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29515086/