public static KeyStoreHandler open(final File keyStoreFile,final char[] password) throws IOException, KeyStoreException {
  if (!keyStoreFile.exists()) {
    throw new FileNotFoundException(keyStoreFile.getAbsolutePath());
  }
  final KeyStore ks=KeyStore.getInstance(KeyStoreHandler.KEYSTORE_TYPE);
  try (final FileInputStream fis=new FileInputStream(keyStoreFile)){
    ks.load(fis,password);
    return new KeyStoreHandler(ks,password,keyStoreFile,KeyStoreHandler.getSecretKeyFactory());
  }
 catch (  final NoSuchAlgorithmException|CertificateException ex) {
    throw new IllegalStateException("Should not happen.",ex);
  }
}

public static KeyStoreHandler open ( final File keyStoreFile , final char [ ] password ) throws IOException , KeyStoreException { if ( ! keyStoreFile . exists ( ) ) { throw new FileNotFoundException ( keyStoreFile . getAbsolutePath ( ) ) ; } final KeyStore ks = KeyStore . getInstance ( KeyStoreHandler . KEYSTORE_TYPE ) ; try ( final FileInputStream fis = new FileInputStream ( keyStoreFile ) ) { ks . load ( fis , password ) ; return new KeyStoreHandler ( ks , password , keyStoreFile , KeyStoreHandler . getSecretKeyFactory ( ) ) ; } catch ( final NoSuchAlgorithmException | CertificateException ex ) { throw new IllegalStateException ( "Should not happen." , ex ) ; } }
open an existing key store , protected by a given password .
