Bad implementation of X25519?
I can't generate a shared secret with the current implementation of X25519
3 Replies
If we look at the implementation we can see the following code:
(https://github.com/denoland/deno/blob/8ae706293149fb6e3d40af3ac80a8661fa379111/ext/crypto/00_crypto.js#L4346)
After some research (https://vnhacker.blogspot.com/2015/09/why-not-validating-curve25519-public.html) I found what the isIdentity test was for
Why not validate Curve25519 public keys could be harmful
Update: see this post for a real world protocol that is broken if Curve25519 public keys are not validated. Update: comments on Twitter ....
And I try to read some rust
(https://github.com/denoland/deno/blob/main/ext/crypto/x25519.rs#L35)
And it seems that the function does not return if it is the identity point, but if the generated secret successfully passes the test
So in the javascript, you should just check if the value is true, correct me if I'm wrong