Skip to content
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

Merged

Conversation

isislovecruft
Copy link
Member

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)

Copy link
Collaborator

@rozbb rozbb left a 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:

  1. 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.
  2. The current docs on StaticSecret make explicit reference to being useful for the Noise protocol. That paragraph should either be deleted or moved to ReusableSecret.

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)]
Copy link
Collaborator

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 {
Copy link
Collaborator

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

@isislovecruft
Copy link
Member Author

Thanks @rozbb! I've implemented your suggestions above.

@isislovecruft isislovecruft merged commit b6f7de1 into dalek-cryptography:develop Sep 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants