signalapp / curve25519-java

Pure Java and JNI backed Curve25519 implementation.
GNU General Public License v3.0
232 stars 93 forks source link

calculateAgreement not NaCl/Sodium compatible #2

Closed unixninja92 closed 9 years ago

unixninja92 commented 9 years ago

I'm running a go server (using NaCl) and an android client. I tried using this library at first to calculate the agreement between the two but kept get getting different results on both sides. I then switched my android client to use kalium, and now it works fine. I feel like I should be able to use either library for this. Is that accurate or is there so difference between the two libs that I'm missing?

unixninja92 commented 9 years ago

Just realized I was using v0.1.3

moxie0 commented 9 years ago

Hey @unixninja92, thanks but this is setup as an issue tracker rather than a discussion or support forum. If you find that this implementation is not compatible with raw curve25519 test vectors (from curve25519-donna for instance), then please post a detailed issue here. Otherwise we're not able to support you.

kennylevinsen commented 7 years ago

A note on this old bug: I believe the problem spawns from curve25519-java having out-commented the input sanitisation of scalarMult, which other implementations maintained (such as golang.org/x/crypto/curve25519). This, in effect, means that while other implementations can take raw random input (which may be present in an ECDH exchange), curve25519-java cannot.

See https://github.com/WhisperSystems/curve25519-java/blob/master/common/src/main/java/org/whispersystems/curve25519/java/scalarmult.java#L26 vs. https://github.com/golang/crypto/blob/master/curve25519/curve25519.go#L796.

I wonder why the code was chosen to be removed (or rather, left behind, out commented)?