Skip to content
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

Simple Diffie-Hellman computation fails. #80

Open
shumy-tools opened this issue Jan 13, 2020 · 1 comment
Open

Simple Diffie-Hellman computation fails. #80

shumy-tools opened this issue Jan 13, 2020 · 1 comment

Comments

@shumy-tools
Copy link

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)
@str4d
Copy link
Owner

str4d commented Apr 29, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants