KeyPairUtils { public static KeyPair createKeyPair() { return createECKeyPair("secp384r1"); } private  KeyPairUtils(); static KeyPair createKeyPair(); static KeyPair createKeyPair(int keysize); static KeyPair createECKeyPair(String name); static KeyPair readKeyPair(Reader r); static void writeKeyPair(KeyPair keypair, Writer w);  }
@Test public void testCreateStandardKeyPair() { KeyPair pair = KeyPairUtils.createKeyPair(); assertThat(pair, is(notNullValue())); assertThat(pair.getPublic(), is(instanceOf(ECPublicKey.class))); ECPublicKey pk = (ECPublicKey) pair.getPublic(); assertThat(pk.getAlgorithm(), is("ECDSA")); assertThat(pk.getParams().getCurve().getField().getFieldSize(), is(384)); }
@Test public void testCreateKeyPair() { KeyPair pair = KeyPairUtils.createKeyPair(KEY_SIZE); assertThat(pair, is(notNullValue())); assertThat(pair.getPublic(), is(instanceOf(RSAPublicKey.class))); RSAPublicKey pub = (RSAPublicKey) pair.getPublic(); assertThat(pub.getModulus().bitLength(), is(KEY_SIZE)); }