code: protected KeyStore getKeyStore(InputStream storeStream, String storePath, String storeType, String storeProvider, String storePassword) throws Exception {
          KeyStore keystore = null;
          if (storeStream != null || storePath != null) {
              InputStream inStream = storeStream;
              try {
                  if (inStream == null) {
                      inStream = new FileInputStream(storePath); //assume it's a file
                  }
                  if (storeProvider != null) {
                      keystore = KeyStore.getInstance(storeType, storeProvider);
                  } else {
                      keystore = KeyStore.getInstance(storeType);
                  }
                  keystore.load(inStream, storePassword == null ? null : storePassword.toCharArray());
              } finally {
                  if (inStream != null) {
                      inStream.close();
                  }
              }
          }
          return keystore;
      }
docs: Loads keystore using an input stream or a file path in the same
  order of precedence.
  
  Required for integrations to be able to override the mechanism
  used to load a keystore in order to provide their own implementation.
  
  @param storeStream keystore input stream
  @param storePath path of keystore file
  @param storeType keystore type
  @param storeProvider keystore provider
  @param storePassword keystore password
  @return created keystore
  @throws Exception if the keystore cannot be obtained