authentication - 为什么 JSON Web 加密 (JWE) 不完整性保护 IV 和内容加密 key ?

标签 authentication encryption jwt jwe

所有 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/

相关文章:

java - 如果我需要将密码解密为明文,如何加密数据库中的密码?

java - 使用 RSA 加密和解密字符串

node.js - 为什么 jwt.sign 函数不能将我的用户识别为对象?

javascript - Passport.js 验证中间件后没有日志

.net - 根据用户请求访问的组织(每个请求)修改 .NET Core 角色

python - Web2Py 最小用户身份验证(仅限用户名)

mongodb - 在 MongoDB 中为现有用户更改密码

ios - 解析 Swift 登录错误 : Invalid User Credentials

php - Web 服务器即时解密?

swift - 如何在允许 JWT 刷新的同时检查 Swift 中的 Auth 用户?