ed25519-java
ed25519-java copied to clipboard
Simple Diffie-Hellman computation fails.
A simple computation as:
final FieldElement nodeSecret = Utils.getRandomFieldElement();
final GroupElement nodeKey = Utils.basePoint.scalarMultiply(nodeSecret.toByteArray());
final FieldElement termSecret = Utils.getRandomFieldElement();
final GroupElement termKey = Utils.basePoint.scalarMultiply(termSecret.toByteArray());
nodeKey.scalarMultiply(termSecret.toByteArray());
Fails with:
Exception in thread "main" java.lang.NullPointerException
at net.i2p.crypto.eddsa.math.GroupElement.select(GroupElement.java:930)
at net.i2p.crypto.eddsa.math.GroupElement.scalarMultiply(GroupElement.java:964)
at AOTMainTest.main(AOTMainTest.java:26)
I'll have a brief look into this at some point, but I recommend using curve25519-elisabeth for these kinds of computations: https://github.com/cryptography-cafe/curve25519-elisabeth