private void createCertificates(String... subjectAltNames)
    throws GeneralSecurityException, IOException, OperatorCreationException {
    X500NameBuilder caNameBuilder = new X500NameBuilder(BCStyle.INSTANCE);
    caNameBuilder.addRDN(BCStyle.CN,
      MethodHandles.lookup().lookupClass().getCanonicalName() + " Root CA");
    trustStoreCertificate =
      X509TestHelpers.newSelfSignedCACert(caNameBuilder.build(), trustStoreKeyPair);

    X500NameBuilder nameBuilder = new X500NameBuilder(BCStyle.INSTANCE);
    nameBuilder.addRDN(BCStyle.CN,
      MethodHandles.lookup().lookupClass().getCanonicalName() + " Zookeeper Test");
    keyStoreCertificate = newCert(nameBuilder.build(), subjectAltNames);
  }
Creates a clone of the current context, but injecting the passed certificate as the KeyStore
cert. The new context's keystore path fields are nulled, so the next call to
{@link #setConfigurations(KeyStoreFileType, KeyStoreFileType)},
{@link #setKeystoreConfigurations(KeyStoreFileType, Configuration)} , or
{@link #getKeyStoreFile(KeyStoreFileType)} will create a new keystore with this certificate in
place.
@param cert the cert to replace
hbase-common/src/test/java/org/apache/hadoop/hbase/io/crypto/tls/X509TestContext.java