public X509Certificate newCert(X500Name name, String... subjectAltNames)
    throws GeneralSecurityException, IOException, OperatorCreationException {
    if (subjectAltNames.length == 0) {
      return X509TestHelpers.newCert(trustStoreCertificate, trustStoreKeyPair, name,
        keyStoreKeyPair.getPublic());
    }
    GeneralName[] names = new GeneralName[subjectAltNames.length];
    for (int i = 0; i < subjectAltNames.length; i++) {
      names[i] = new GeneralName(GeneralName.dNSName, subjectAltNames[i]);
    }
    return X509TestHelpers.newCert(trustStoreCertificate, trustStoreKeyPair, name,
      keyStoreKeyPair.getPublic(), new GeneralNames(names));
  }
Generates a new certificate using this context's CA and keystoreKeyPair. By default, the cert
will have localhost in the subjectAltNames. This can be overridden by passing one or more
string arguments after the cert name. The expectation for those arguments is that they are
valid DNS names.
hbase-common/src/test/java/org/apache/hadoop/hbase/io/crypto/tls/X509TestContext.java