-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Curious about key exchange construction #586
Comments
Hi,
The input and output of this function represent points coordinates (in that specific case, only the x coordinate). Even though these coordinates are encoded as 256 bits, the number of points in the group is much smaller (about 2^252). Furthermore, the distribution of these x coordinates is not uniform. Some bits are "more random" than others. This makes related-key attacks a more serious issue on affected ciphers. Hashing the output solves the second issue. Including public keys allows the full 2^256 key space to be used, and mitigates subtle attacks leveraging the fact that While the output of the scalar multiplication can be used directly as a shared key, hashing the result is a simple and fast operation, so skipping this step is rarely justified.
|
Thank you for that explanation, @jedisct1. I found this part most surprising:
Since |
Yes. Namely, you can't rely on public keys to ensure that you're talking to the intended recipient. This is not an issue in properly designed protocols. |
This is surprising to me. The documentation on the
And also:
So I feel like there is a contradiction. Are we perhaps talking about 2 subtly different guarantees? Thank you very much for your help in this. |
That documentation page is terrible and should be rewritten at some point. Messages sent using |
I see your point about the wording of that documentation. It can be read to imply It seems So as a table, it would look like:
It seems like here you might be trying to say that What I'm struggling to understand is how that can be true without undermining the authenticated encryption guarantees of Hopefully I finally get it this time. :) Thank you much for your patience. |
x25519 security is < 126 bits since the order of the main subgroup is ~ 2^252. It doesn't make any practical difference. Given Not including that key, as in |
Whoa, I finally get it! 🎉 Thank you! I was even able to take your example and find reference to it in RFC 7748 Section 7. Very cool. I'll have some fun coming up with an example system that is vulnerable like this. Thanks again! Keep up the great work! |
I noticed that for the
kx
construction, both public keys are added to the KDF hash. (source)I am under the impression that the public keys are already incorporated into the derived key, in a way, by the
scalarmult
step. (source)Is adding the public keys to the KDF hash done merely out of an abundance of caution, or does it prevent a concrete attack on the plain
scalarmult
?Thank you for writing this package so cleanly that I can link to small pieces of the source to help ask my question. 😄
The text was updated successfully, but these errors were encountered: