@Test public void success_GeneratePublicKeySeed_via_SHA_512_from_hex_string_1() { PrivateKey privateKey = PrivateKeyEd25519.fromHexString("ab4195d4123f0594e5341c45134c5938cc5913d34aa951234c5938cc2a6eb487"); PublicKeyDelegate delegate1 = new Ed25519PublicKeyDelegate(HashAlgorithm.SHA_512); byte[] seed = delegate1.generatePublicKeySeed(privateKey); assertThat(HexEncoder.getString(seed), is("9b69ec0a4568848ec9bd9190996fce5a5f46d0a8eb20cdd770953e61855438ef")); }
@Override public byte[] generatePublicKeySeed(PrivateKey privateKey) { if (!(privateKey instanceof PrivateKeyEd25519)) { throw new IllegalArgumentException("Public key on Curve25519 must be " + CURVE.getPublicKeyByteLength() + " byte length. Length: " + privateKey.getRaw().length); } BigInteger s = privateKey.getScalarSeed(this); Point point = CURVE.getBasePoint().scalarMultiply(s); return point.encode().getValue(); }
Ed25519PublicKeyDelegate implements PublicKeyDelegate { @Override public byte[] generatePublicKeySeed(PrivateKey privateKey) { if (!(privateKey instanceof PrivateKeyEd25519)) { throw new IllegalArgumentException("Public key on Curve25519 must be " + CURVE.getPublicKeyByteLength() + " byte length. Length: " + privateKey.getRaw().length); } BigInteger s = privateKey.getScalarSeed(this); Point point = CURVE.getBasePoint().scalarMultiply(s); return point.encode().getValue(); } }
Ed25519PublicKeyDelegate implements PublicKeyDelegate { @Override public byte[] generatePublicKeySeed(PrivateKey privateKey) { if (!(privateKey instanceof PrivateKeyEd25519)) { throw new IllegalArgumentException("Public key on Curve25519 must be " + CURVE.getPublicKeyByteLength() + " byte length. Length: " + privateKey.getRaw().length); } BigInteger s = privateKey.getScalarSeed(this); Point point = CURVE.getBasePoint().scalarMultiply(s); return point.encode().getValue(); } Ed25519PublicKeyDelegate(HashAlgorithm hashAlgorithm); }
Ed25519PublicKeyDelegate implements PublicKeyDelegate { @Override public byte[] generatePublicKeySeed(PrivateKey privateKey) { if (!(privateKey instanceof PrivateKeyEd25519)) { throw new IllegalArgumentException("Public key on Curve25519 must be " + CURVE.getPublicKeyByteLength() + " byte length. Length: " + privateKey.getRaw().length); } BigInteger s = privateKey.getScalarSeed(this); Point point = CURVE.getBasePoint().scalarMultiply(s); return point.encode().getValue(); } Ed25519PublicKeyDelegate(HashAlgorithm hashAlgorithm); @Override byte[] generatePublicKeySeed(PrivateKey privateKey); @Override byte[] hashPrivateKey(PrivateKey privateKey); }
Ed25519PublicKeyDelegate implements PublicKeyDelegate { @Override public byte[] generatePublicKeySeed(PrivateKey privateKey) { if (!(privateKey instanceof PrivateKeyEd25519)) { throw new IllegalArgumentException("Public key on Curve25519 must be " + CURVE.getPublicKeyByteLength() + " byte length. Length: " + privateKey.getRaw().length); } BigInteger s = privateKey.getScalarSeed(this); Point point = CURVE.getBasePoint().scalarMultiply(s); return point.encode().getValue(); } Ed25519PublicKeyDelegate(HashAlgorithm hashAlgorithm); @Override byte[] generatePublicKeySeed(PrivateKey privateKey); @Override byte[] hashPrivateKey(PrivateKey privateKey);  }