code: public static KeyStore toKeyStore(InputStream keyStoreInputStream, char [] keyStorePassword) throws CertificateException {
          Assert.notNull(keyStoreInputStream, "InputStream of key store is mandatory");
          Assert.notNull(keyStorePassword, "Password for key store is mandatory");
          try {
              KeyStore keystore = KeyStore.getInstance("PKCS12");
              keystore.load(keyStoreInputStream, keyStorePassword);
              return keystore;
          } catch (IOException | NoSuchAlgorithmException | KeyStoreException ex) {
              throw new IllegalStateException("Failed to load signing information", ex);
          }
      }
docs: Load a keystore from an already opened {@link InputStream}.
  The caller is responsible for closing the stream after this method completes successfully or fails.
  
  @param keyStoreInputStream {@link InputStream} containing the signing key store.
  @param keyStorePassword password to access the key store.
  @return {@link KeyStore} loaded from {@code keyPath}
  @throws IllegalArgumentException
  If either {@code keyPath} is or {@code keyPath}  or {@code keyPassword} is empty.
  @throws IllegalStateException
  If {@link KeyStore} loading failed.
  @throws CertificateException
  If any of the certificates in the keystore could not be loaded.