use of com.github.rosklyar.crypto.ed25519.arithmetic.Ed25519GroupElement in project nem2-sdk-java by nemtech.
the class Ed25519KeyGeneratorTest method derivedPublicKeyIsValidPointOnCurve.
@Test
public void derivedPublicKeyIsValidPointOnCurve() {
// Arrange:
final KeyGenerator generator = this.getKeyGenerator();
for (int i = 0; i < 100; i++) {
final KeyPair kp = generator.generateKeyPair();
// Act:
final PublicKey publicKey = generator.derivePublicKey(kp.getPrivateKey());
// Assert (throws if not on the curve):
Ed25519GroupElement decode = new Ed25519EncodedGroupElement(publicKey.getBytes()).decode();
Assertions.assertNotNull(decode);
}
}
Aggregations