-
Notifications
You must be signed in to change notification settings - Fork 36
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
Standard implementation option #153
base: master
Are you sure you want to change the base?
Standard implementation option #153
Conversation
…o omit username when calculating X
srp/src/utils.rs
Outdated
// M1 = H(H(N) XOR H(g) | H(U) | s | A | B | K) this follows the spec | ||
#[must_use] | ||
pub fn compute_m1_std<D: Digest>( |
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.
"Spec" doesn't say which spec, and std
in particular is easily confused with the Rust standard library.
Perhaps use RFC5054 instead?
// M1 = H(H(N) XOR H(g) | H(U) | s | A | B | K) this follows the spec | |
#[must_use] | |
pub fn compute_m1_std<D: Digest>( | |
/// M1 = H(H(N) XOR H(g) | H(U) | s | A | B | K) following RFC5054 | |
#[must_use] | |
pub fn compute_m1_rfc5054<D: Digest>( |
srp/src/client.rs
Outdated
|
||
/// SRP client state before handshake with the server. | ||
pub struct SrpClient<'a, D: Digest> { | ||
params: &'a SrpGroup, | ||
by_the_spec: bool, | ||
no_user_in_x: bool, |
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.
Why is this a separate variable?
srp/src/client.rs
Outdated
|
||
/// SRP client state before handshake with the server. | ||
pub struct SrpClient<'a, D: Digest> { | ||
params: &'a SrpGroup, | ||
by_the_spec: bool, |
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.
An enum might be nice here for clarity
OK, I decided to change my implementation completely. Please review this new code and let me know you like this approach better or not. Thanks |
m1: Output<D>, | ||
m2: Output<D>, | ||
key: Vec<u8>, | ||
session_key: Vec<u8>, |
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.
I think you can use D::Output
for session_key
.
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.
Yes, I think we can use D::Output
as long as we have a getter method that returns this in a more primitive type, because at least in my use-case, this session key is used for every encryption after the key agreement.
It is nicer to hide away all these types used internally before the output
Added an option to use the implementation in the spec
also added an option to omit username when calculating X
It's a draft implementation to start conversation on it.
Please let me know what you think about it.
closes #152