static SslContextFactory createSslContextFactory(Configuration conf) throws IOException {
    final boolean useSsl  = MetastoreConf.getBoolVar(conf, MetastoreConf.ConfVars.USE_SSL);
    if (!useSsl) {
      return null;
    }
    final String keyStorePath = MetastoreConf.getVar(conf, MetastoreConf.ConfVars.SSL_KEYSTORE_PATH).trim();
    if (keyStorePath.isEmpty()) {
      throw new IllegalArgumentException(MetastoreConf.ConfVars.SSL_KEYSTORE_PATH
          + " Not configured for SSL connection");
    }
    final String keyStorePassword =
        MetastoreConf.getPassword(conf, MetastoreConf.ConfVars.SSL_KEYSTORE_PASSWORD);
    final String keyStoreType =
        MetastoreConf.getVar(conf, MetastoreConf.ConfVars.SSL_KEYSTORE_TYPE).trim();
    final String keyStoreAlgorithm =
        MetastoreConf.getVar(conf, MetastoreConf.ConfVars.SSL_KEYMANAGERFACTORY_ALGORITHM).trim();
    final String[] excludedProtocols =
        MetastoreConf.getVar(conf, MetastoreConf.ConfVars.SSL_PROTOCOL_BLACKLIST).split(",");
    if (LOG.isInfoEnabled()) {
      LOG.info("HTTP Server SSL: adding excluded protocols: {}", Arrays.toString(excludedProtocols));
    }
    SslContextFactory factory = new SslContextFactory.Server();
    factory.addExcludeProtocols(excludedProtocols);
    if (LOG.isInfoEnabled()) {
      LOG.info("HTTP Server SSL: SslContextFactory.getExcludeProtocols = {}",
        Arrays.toString(factory.getExcludeProtocols()));
    }
    factory.setKeyStorePath(keyStorePath);
    factory.setKeyStorePassword(keyStorePassword);
    factory.setKeyStoreType(keyStoreType);
    factory.setKeyManagerFactoryAlgorithm(keyStoreAlgorithm);
    return factory;
  }
Creates an SSL context factory if configuration states so.
@param conf the configuration
@return null if no ssl in config, an instance otherwise
@throws IOException if getting password fails
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/ServletSecurity.java