traits
traits copied to clipboard
Zeroize for GenericArray based keys
The xsalsa20poly1305
Key
is an alias for GenericArray<u8, <Salsa<R20> as NewCipher>::KeySize>
. This means that zeroize is not used, and the key is not zeroed on drop.
I'm not too much familiar with how the different crates and traits interact, but in general it would be desirable if secret keys would be zeroized on drop. According to @tarcieri this repo is the right place to file an issue:
it's defined at a trait-level though, so you can't just fix one crate
To have a proper solution for this we'd need to define a newtype wrapper for AEAD keys.
There are many reasons why this might be a good idea. We could place the random key generation methods on that type, for example.
It'd also permit changing the internal representation of an AEAD key without making a user-facing API change.
Right now we have the Key
type alias built on top of the KeySizeUser
trait. We could make it a wrapper type instead, but we should be careful about resulting ergonomics.
We are in the process of migrating from generic-array
to hybrid-array
, so I think we can close this issue.