New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement reused secret keys for Noise/X3DH/etc protocols #71
Implement reused secret keys for Noise/X3DH/etc protocols #71
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! I like that it's feature-gated, since this use case is kind of niche. Two notes:
- The current docs on
StaticSecret
don't contain the same "if you don't know what to use, please use EphemeralSecret" warning. I think it should, for the same reason that it appears here. I don't feel strongly about that though. - The current docs on
StaticSecret
make explicit reference to being useful for the Noise protocol. That paragraph should either be deleted or moved toReusableSecret
.
src/x25519.rs
Outdated
/// secret keys are never reused, which can have very serious security | ||
/// implications for many protocols. | ||
#[cfg(feature = "reusable_secrets")] | ||
#[derive(Zeroize)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might wanna make it Clone
too, just for usability sake
} | ||
|
||
/// Generate a non-serializeable x25519 key. | ||
pub fn new<T: RngCore + CryptoRng>(mut csprng: T) -> Self { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Generate a non-serializable x25519 secret key."
or, copying from EphemeralSecret
,
"Generate an x25519 [ReusableSecret
] key."
Either one, I just think the word "secret" needs to be somewhere because "key" is ambiguous
Thanks @rozbb! I've implemented your suggestions above. |
This implements secret keys which are technically reusable, but discouraged from reuse due to not having serialisation methods, in order to facilitate certain keying constructs in the Noise protocol and others which require doing Diffie-Hellman operations more than once with a single somewhat-ephemeral key. (cf. #57)