ECUtil { public static KeyPair createKeyPair() { return createKeyPair((byte[]) null); } private  ECUtil(); static byte[] createUncompressedPublicKey(ECPublicKey ecPublicKey); static byte[] convertToFixedByteArray(BigInteger value); static byte[] convertToFixedByteArray(int fixedSize, BigInteger value); static KeyPair createKeyPair(); static PublicKey createPublicKey(ECPublicKeySpec ecPublicKeySpec); static PrivateKey createPrivateKey(ECPrivateKeySpec ecPrivateKeySpec); static KeyPair createKeyPair(byte[] seed, ECParameterSpec ecParameterSpec); static KeyPair createKeyPair(byte[] seed); static KeyPair createKeyPair(ECParameterSpec ecParameterSpec); static PublicKey createPublicKeyFromUncompressed(byte[] publicKey); static final ECParameterSpec P_256_SPEC; static final ECParameterSpec P_384_SPEC; static final ECParameterSpec P_521_SPEC; }
@Test void createKeyPair_test() { KeyPair keyPair = ECUtil.createKeyPair(); assertThat(keyPair).isNotNull(); }
@Test void createKeyPair_test_with_seed() { byte[] seed = new byte[]{0x01, 0x23, 0x45}; KeyPair keyPairA = ECUtil.createKeyPair(seed); KeyPair keyPairB = ECUtil.createKeyPair(seed); assertThat(keyPairA.getPrivate().getEncoded()).isEqualTo(keyPairB.getPrivate().getEncoded()); }