public static KeyPair createECKeyPair(String name) throws IOException {
  try {
    ECGenParameterSpec ecSpec=new ECGenParameterSpec(name);
    KeyPairGenerator keyGen=KeyPairGenerator.getInstance("EC");
    keyGen.initialize(ecSpec,new SecureRandom());
    return keyGen.generateKeyPair();
  }
 catch (  NoSuchAlgorithmException|InvalidAlgorithmParameterException ex) {
    throw new IOException(ex);
  }
}

public static KeyPair createECKeyPair ( String name ) throws IOException { try { ECGenParameterSpec ecSpec = new ECGenParameterSpec ( name ) ; KeyPairGenerator keyGen = KeyPairGenerator . getInstance ( "EC" ) ; keyGen . initialize ( ecSpec , new SecureRandom ( ) ) ; return keyGen . generateKeyPair ( ) ; } catch ( NoSuchAlgorithmException | InvalidAlgorithmParameterException ex ) { throw new IOException ( ex ) ; } }
creates a random ecc key pair with the given curve name .
