Appendix B. 两层 Recipient 信息
Appendix B. 两层 Recipient 信息
当前定义的所有 recipient 算法类别都只使用 COSE 结构的两层. 第一层 (COSE_Encrypt) 是消息内容, 第二层 (COSE_Recipient) 是内容密钥加密. 然而, 如果使用诸如 RSA Key Encapsulation Mechanism (RSA-KEM) 这样的 recipient 算法 (见 RSA-KEM [RFC5990] 的 Appendix A), 那么使用两层 COSE_Recipient 结构是合理的.
这些层如下:
-
Layer 0: 内容加密层. 此层包含消息的 payload.
-
Layer 1: 用 KEK 对 CEK 加密.
-
Layer 2: 使用 RSA 密钥加密长随机 secret, 并用 key derivation function 将该 secret 转换为 KEK.
以下是三层消息的示例. 为便于阅读, 它使用扩展 CBOR 诊断记法 (在 [RFC8610] 中定义) 呈现, 而不是二进制 dump. 该消息具有以下层:
-
Layer 0: 使用 128-bit 密钥的 AES-GCM 加密内容.
-
Layer 1: 使用 128-bit 密钥的 AES Key Wrap 算法.
-
Layer 2: 使用 ECDH Ephemeral-Static direct 生成 Layer 1 密钥.
实际上, 此示例是使用 ECDH-ES+A128KW 算法的分解版本.
二进制文件大小为 183 字节
96(
[ / COSE_Encrypt /
/ protected h'a10101' / << {
/ alg / 1:1 / AES-GCM 128 /
} >>,
/ unprotected / {
/ iv / 5:h'02d1f7e6f26c43d4868d87ce'
},
/ ciphertext / h'64f84d913ba60a76070a9a48f26e97e863e2852948658f0
811139868826e89218a75715b',
/ recipients / [
[ / COSE_Recipient /
/ protected / h'',
/ unprotected / {
/ alg / 1:-3 / A128KW /
},
/ ciphertext / h'dbd43c4e9d719c27c6275c67d628d493f090593db82
18f11',
/ recipients / [
[ / COSE_Recipient /
/ protected h'a1013818' / << {
/ alg / 1:-25 / ECDH-ES + HKDF-256 /
} >> ,
/ unprotected / {
/ ephemeral / -1:{
/ kty / 1:2,
/ crv / -1:1,
/ x / -2:h'b2add44368ea6d641f9ca9af308b4079aeb519f11
e9b8a55a600b21233e86e68',
/ y / -3:false
},
/ kid / 4:'[email protected]'
},
/ ciphertext / h''
]
]
]
]
]
)