public static KeyPair generateKeyPair(X509KeyType keyType) throws GeneralSecurityException {
    switch (keyType) {
      case RSA:
        return generateRSAKeyPair();
      case EC:
        return generateECKeyPair();
      default:
        throw new IllegalArgumentException("Invalid X509KeyType");
    }
  }
Generates a new asymmetric key pair of the given type.
@param keyType the type of key pair to generate.
@return the new key pair.
@throws GeneralSecurityException if your java crypto providers are messed up.
hbase-common/src/test/java/org/apache/hadoop/hbase/io/crypto/tls/X509TestHelpers.java