str4d / ed25519-java

Pure Java implementation of EdDSA
Creative Commons Zero v1.0 Universal
220 stars 74 forks source link

java.lang.IllegalArgumentException: not a valid GroupElement #65

Closed Synesso closed 5 years ago

Synesso commented 6 years ago

Triggered by https://github.com/stellar/java-stellar-sdk/issues/131

Replicate with the following:

byte[] key = {15, -29, -22, -17, 22, 101, -81, -39, -118, 124, -14, -105, -52, 109, -6, 88, 17, 12, -13, 93, 59, 104, 63, -13, -94, 52, -24, -125, 76, -23, 113, -47};
new EdDSAPublicKeySpec(key, EdDSANamedCurveTable.getByName("ed25519"));

In v0.3.0, results in:

Exception in thread "main" java.lang.IllegalArgumentException: not a valid GroupElement
    at net.i2p.crypto.eddsa.math.GroupElement.<init>(GroupElement.java:336)
    at net.i2p.crypto.eddsa.math.GroupElement.<init>(GroupElement.java:287)
    at net.i2p.crypto.eddsa.spec.EdDSAPublicKeySpec.<init>(EdDSAPublicKeySpec.java:36)

What's happening here?

str4d commented 5 years ago

This error is saying that the given 32-byte string does not encode a valid Ed25519 group element, meaning that the public key being passed to EdDSAPublicKeySpec is invalid. It looks like this was identified in the referenced issue.