public static KeyStore load(File keyStoreFile,Password password,KeyStoreType keyStoreType) throws CryptoException, FileNotFoundException {
  if (!keyStoreType.isFileBased()) {
    throw new CryptoException(MessageFormat.format(res.getString("NoLoadKeyStoreNotFile.exception.message"),keyStoreType.jce()));
  }
  FileInputStream fis=new FileInputStream(keyStoreFile);
  KeyStore keyStore=getKeyStoreInstance(keyStoreType);
  try {
    keyStore.load(fis,password.toCharArray());
  }
 catch (  CertificateException ex) {
    throw new KeyStoreLoadException(MessageFormat.format(res.getString("NoLoadKeyStoreType.exception.message"),keyStoreType),ex,keyStoreType);
  }
catch (  NoSuchAlgorithmException ex) {
    throw new KeyStoreLoadException(MessageFormat.format(res.getString("NoLoadKeyStoreType.exception.message"),keyStoreType),ex,keyStoreType);
  }
catch (  FileNotFoundException ex) {
    throw ex;
  }
catch (  IOException ex) {
    throw new KeyStoreLoadException(MessageFormat.format(res.getString("NoLoadKeyStoreType.exception.message"),keyStoreType),ex,keyStoreType);
  }
 finally {
    IOUtils.closeQuietly(fis);
  }
  return keyStore;
}

public static KeyStore load ( File keyStoreFile , Password password , KeyStoreType keyStoreType ) throws CryptoException , FileNotFoundException { if ( ! keyStoreType . isFileBased ( ) ) { throw new CryptoException ( MessageFormat . format ( res . getString ( "NoLoadKeyStoreNotFile.exception.message" ) , keyStoreType . jce ( ) ) ) ; } FileInputStream fis = new FileInputStream ( keyStoreFile ) ; KeyStore keyStore = getKeyStoreInstance ( keyStoreType ) ; try { keyStore . load ( fis , password . toCharArray ( ) ) ; } catch ( CertificateException ex ) { throw new KeyStoreLoadException ( MessageFormat . format ( res . getString ( "NoLoadKeyStoreType.exception.message" ) , keyStoreType ) , ex , keyStoreType ) ; } catch ( NoSuchAlgorithmException ex ) { throw new KeyStoreLoadException ( MessageFormat . format ( res . getString ( "NoLoadKeyStoreType.exception.message" ) , keyStoreType ) , ex , keyStoreType ) ; } catch ( FileNotFoundException ex ) { throw ex ; } catch ( IOException ex ) { throw new KeyStoreLoadException ( MessageFormat . format ( res . getString ( "NoLoadKeyStoreType.exception.message" ) , keyStoreType ) , ex , keyStoreType ) ; } finally { IOUtils . closeQuietly ( fis ) ; } return keyStore ; }
load a keystore from a file accessed by a password .
