private void loadKeyManager() {
    KeyManager[] keyManagers;
    try {
      KeyStore keyStore;
      if (StringUtils.isEmpty(keyStoreType)) {
        keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
      } else {
        keyStore = KeyStore.getInstance(keyStoreType);
      }

      String keyStoreFilePath = keyStorePath.toString();
      if (StringUtils.isEmpty(keyStoreFilePath)) {
        keyStoreFilePath =
            System.getProperty("user.home") + System.getProperty("file.separator") + ".keystore";
      }

      char[] password = null;
      try (FileInputStream fileInputStream = new FileInputStream(keyStoreFilePath)) {
        String passwordString = keyStorePassword;
        if (passwordString != null) {
          if (passwordString.trim().equals("")) {
            String encryptedPass = System.getenv("javax.net.ssl.keyStorePassword");
            if (!StringUtils.isEmpty(encryptedPass)) {
              String toDecrypt = "encrypted(" + encryptedPass + ")";
              passwordString = PasswordUtil.decrypt(toDecrypt);
              password = passwordString.toCharArray();
            }
          } else {
            password = passwordString.toCharArray();
          }
        }
        keyStore.load(fileInputStream, password);
      }

      // default algorithm can be changed by setting property "ssl.KeyManagerFactory.algorithm" in
      // security properties
      KeyManagerFactory keyManagerFactory =
          KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
      keyManagerFactory.init(keyStore, password);
      keyManagers = keyManagerFactory.getKeyManagers();

      // follow the security tip in java doc
      if (password != null) {
        java.util.Arrays.fill(password, ' ');
      }
    } catch (Exception e) {
      throw new InternalGemFireException("Unable to load KeyManager", e);
    }

    for (KeyManager km : keyManagers) {
      if (km instanceof X509ExtendedKeyManager) {

        ExtendedAliasKeyManager extendedAliasKeyManager =
            new ExtendedAliasKeyManager((X509ExtendedKeyManager) km, keyStoreAlias);

        if (keyManager.getAndSet(extendedAliasKeyManager) == null) {
          logger.info("Initialized KeyManager for {}", keyStorePath);
        } else {
          logger.info("Updated KeyManager for {}", keyStorePath);
        }

        return;
      }
    }

    throw new IllegalStateException("No X509ExtendedKeyManager available");
  }
Returns a {@link FileWatchingX509ExtendedKeyManager} for the given SSL config. A new instance
will be created only if one does not already exist for the provided key store path and alias.

@param keyStorePath The path of the key store to watch for changes (or create if one does not
       yet exist).
@param type The type of store to create - typically "JKS"
@param password The password to use to secure the store
@param alias The alias to use
geode-core/src/main/java/org/apache/geode/internal/net/filewatch/FileWatchingX509ExtendedKeyManager.java