Summary
aes-kw (v0.3.0) provides KwAes256 for AES Key Wrap (RFC 3394), but has no zeroize feature and does not clear expanded cipher state when AesKw is dropped.
Background
Typical JWE ECDH-ES+A256KW usage:
let cek = Zeroizing::new(Aes256Gcm::generate_key(&mut OsRng));
let wrapping_key_kdf = concat_kdf(ECDH_ES_A256KW, 32, &z)?;
let wrapping_cipher = KwAes256::new_from_slice(wrapping_key_kdf.as_slice())?;
wrapping_cipher.wrap_key(&cek, &mut encrypted_key)?;
cek and ECDH shared secret can be zeroized, but KwAes256 itself cannot be wrapped by Zeroizing and has no drop-time zeroization contract.
Current behavior
aes-kw has no zeroize feature.
- It depends on
aes 0.9, but does not enable aes/zeroize.
AesKw<C> is a wrapper around cipher: C with no Drop zeroization behavior.
Expected behavior
- Add optional
zeroize feature and propagate to aes/zeroize.
- Implement
ZeroizeOnDrop (or equivalent drop-time clearing) for AesKw<C> when inner cipher supports it.
Thanks to @Cropi 's work.
Summary
aes-kw(v0.3.0) providesKwAes256for AES Key Wrap (RFC 3394), but has nozeroizefeature and does not clear expanded cipher state whenAesKwis dropped.Background
Typical JWE
ECDH-ES+A256KWusage:cekand ECDH shared secret can be zeroized, butKwAes256itself cannot be wrapped byZeroizingand has no drop-time zeroization contract.Current behavior
aes-kwhas nozeroizefeature.aes0.9, but does not enableaes/zeroize.AesKw<C>is a wrapper aroundcipher: Cwith noDropzeroization behavior.Expected behavior
zeroizefeature and propagate toaes/zeroize.ZeroizeOnDrop(or equivalent drop-time clearing) forAesKw<C>when inner cipher supports it.Thanks to @Cropi 's work.