protected Password unlockEntry(String alias,KeyStoreState state){
  try {
    KeyStore keyStore=state.getKeyStore();
    DGetPassword dGetPassword=new DGetPassword(frame,MessageFormat.format(res.getString("KeyStoreExplorerAction.UnlockEntry.Title"),alias));
    dGetPassword.setLocationRelativeTo(frame);
    dGetPassword.setVisible(true);
    Password password=dGetPassword.getPassword();
    if (password == null) {
      return null;
    }
    keyStore.getKey(alias,password.toCharArray());
    state.setEntryPassword(alias,password);
    kseFrame.updateControls(true);
    return password;
  }
 catch (  GeneralSecurityException ex) {
    String problemStr=MessageFormat.format(res.getString("KeyStoreExplorerAction.NoUnlockEntry.Problem"),alias);
    String[] causes=new String[]{res.getString("KeyStoreExplorerAction.PasswordIncorrectEntry.Cause")};
    Problem problem=new Problem(problemStr,causes,ex);
    DProblem dProblem=new DProblem(frame,res.getString("KeyStoreExplorerAction.ProblemUnlockingEntry.Title"),problem);
    dProblem.setLocationRelativeTo(frame);
    dProblem.setVisible(true);
    return null;
  }
}

protected Password unlockEntry ( String alias , KeyStoreState state ) { try { KeyStore keyStore = state . getKeyStore ( ) ; DGetPassword dGetPassword = new DGetPassword ( frame , MessageFormat . format ( res . getString ( "KeyStoreExplorerAction.UnlockEntry.Title" ) , alias ) ) ; dGetPassword . setLocationRelativeTo ( frame ) ; dGetPassword . setVisible ( true ) ; Password password = dGetPassword . getPassword ( ) ; if ( password == null ) { return null ; } keyStore . getKey ( alias , password . toCharArray ( ) ) ; state . setEntryPassword ( alias , password ) ; kseFrame . updateControls ( true ) ; return password ; } catch ( GeneralSecurityException ex ) { String problemStr = MessageFormat . format ( res . getString ( "KeyStoreExplorerAction.NoUnlockEntry.Problem" ) , alias ) ; String [ ] causes = new String [ ] { res . getString ( "KeyStoreExplorerAction.PasswordIncorrectEntry.Cause" ) } ; Problem problem = new Problem ( problemStr , causes , ex ) ; DProblem dProblem = new DProblem ( frame , res . getString ( "KeyStoreExplorerAction.ProblemUnlockingEntry.Title" ) , problem ) ; dProblem . setLocationRelativeTo ( frame ) ; dProblem . setVisible ( true ) ; return null ; } }
unlock a key or key pair entry . updates the keystore history with the password .
