private Pair<Key,char[]> recoverKey(String alias,char[] storePass,char[] keyPass) throws Exception {
  Key key=null;
  if (keyStore.containsAlias(alias) == false) {
    MessageFormat form=new MessageFormat(rb.getString("Alias.alias.does.not.exist"));
    Object[] source={alias};
    throw new Exception(form.format(source));
  }
  if (!keyStore.entryInstanceOf(alias,KeyStore.PrivateKeyEntry.class) && !keyStore.entryInstanceOf(alias,KeyStore.SecretKeyEntry.class)) {
    MessageFormat form=new MessageFormat(rb.getString("Alias.alias.has.no.key"));
    Object[] source={alias};
    throw new Exception(form.format(source));
  }
  if (keyPass == null) {
    try {
      key=keyStore.getKey(alias,storePass);
      keyPass=storePass;
      passwords.add(keyPass);
    }
 catch (    UnrecoverableKeyException e) {
      if (!token) {
        keyPass=getKeyPasswd(alias,null,null);
        key=keyStore.getKey(alias,keyPass);
      }
 else {
        throw e;
      }
    }
  }
 else {
    key=keyStore.getKey(alias,keyPass);
  }
  return Pair.of(key,keyPass);
}

private Pair < Key , char [ ] > recoverKey ( String alias , char [ ] storePass , char [ ] keyPass ) throws Exception { Key key = null ; if ( keyStore . containsAlias ( alias ) == false ) { MessageFormat form = new MessageFormat ( rb . getString ( "Alias.alias.does.not.exist" ) ) ; Object [ ] source = { alias } ; throw new Exception ( form . format ( source ) ) ; } if ( ! keyStore . entryInstanceOf ( alias , KeyStore . PrivateKeyEntry . class ) && ! keyStore . entryInstanceOf ( alias , KeyStore . SecretKeyEntry . class ) ) { MessageFormat form = new MessageFormat ( rb . getString ( "Alias.alias.has.no.key" ) ) ; Object [ ] source = { alias } ; throw new Exception ( form . format ( source ) ) ; } if ( keyPass == null ) { try { key = keyStore . getKey ( alias , storePass ) ; keyPass = storePass ; passwords . add ( keyPass ) ; } catch ( UnrecoverableKeyException e ) { if ( ! token ) { keyPass = getKeyPasswd ( alias , null , null ) ; key = keyStore . getKey ( alias , keyPass ) ; } else { throw e ; } } } else { key = keyStore . getKey ( alias , keyPass ) ; } return Pair . of ( key , keyPass ) ; }
recovers ( private ) key associated with given alias .
