PrivateKey { public static PrivateKey newInstance(byte[] seed) { switch (seed.length) { case 32: return PrivateKeyEd25519.fromBytes(seed); case 57: return PrivateKeyEd448.fromBytes(seed); default: throw new IllegalArgumentException("PrivateKey byte length " + seed.length + " is not supported."); } } protected  PrivateKey(byte[] value); static PrivateKey newInstance(byte[] seed); static PrivateKey newInstance(String hexString); abstract BigInteger getScalarSeed(HashDelegate hashDelegate); byte[] getRaw(); BigInteger getInteger(); String getHexString(); @Override int hashCode(); @Override boolean equals(final Object obj);  }
@Test public void success_GeneratePrivateKey_2() { PrivateKey privateKey = PrivateKey.newInstance("ab4195d4123f0594e5341c45134c5938cc5913d34aa951234c5938cc2a6eb487"); boolean isKey25519 = privateKey instanceof PrivateKeyEd25519; assertThat(isKey25519, is(true)); }
@Test(expected = IllegalArgumentException.class) public void failure_GeneratePrivateKey() { PrivateKey.newInstance(new byte[56]); PrivateKey.newInstance(new byte[31]); }