private KeyPair generateKeyPair(String algorithm) {
    try {
      KeyPairGenerator keyGen = KeyPairGenerator.getInstance(algorithm);
      keyGen.initialize(2048);
      return keyGen.genKeyPair();
    } catch (NoSuchAlgorithmException nex) {
      throw new RuntimeException("Unable to generate " + algorithm + " keypair");
    }
  }
Class which allows easily building certificates. It can also be used to build
Certificate Authorities. The class is intended to be used in conjunction with {@link CertStores}
to facilitate building key and trust stores.
geode-junit/src/main/java/org/apache/geode/cache/ssl/CertificateBuilder.java