private Pair<Entry,char[]> recoverEntry(KeyStore ks,String alias,char[] pstore,char[] pkey) throws Exception {
  if (ks.containsAlias(alias) == false) {
    MessageFormat form=new MessageFormat(rb.getString("Alias.alias.does.not.exist"));
    Object[] source={alias};
    throw new Exception(form.format(source));
  }
  PasswordProtection pp=null;
  Entry entry;
  try {
    entry=ks.getEntry(alias,pp);
    pkey=null;
  }
 catch (  UnrecoverableEntryException une) {
    if (P11KEYSTORE.equalsIgnoreCase(ks.getType()) || KeyStoreUtil.isWindowsKeyStore(ks.getType())) {
      throw une;
    }
    if (pkey != null) {
      pp=new PasswordProtection(pkey);
      entry=ks.getEntry(alias,pp);
    }
 else {
      try {
        pp=new PasswordProtection(pstore);
        entry=ks.getEntry(alias,pp);
        pkey=pstore;
      }
 catch (      UnrecoverableEntryException une2) {
        if (P12KEYSTORE.equalsIgnoreCase(ks.getType())) {
          throw une2;
        }
 else {
          pkey=getKeyPasswd(alias,null,null);
          pp=new PasswordProtection(pkey);
          entry=ks.getEntry(alias,pp);
        }
      }
    }
  }
  return Pair.of(entry,pkey);
}

private Pair < Entry , char [ ] > recoverEntry ( KeyStore ks , String alias , char [ ] pstore , char [ ] pkey ) throws Exception { if ( ks . containsAlias ( alias ) == false ) { MessageFormat form = new MessageFormat ( rb . getString ( "Alias.alias.does.not.exist" ) ) ; Object [ ] source = { alias } ; throw new Exception ( form . format ( source ) ) ; } PasswordProtection pp = null ; Entry entry ; try { entry = ks . getEntry ( alias , pp ) ; pkey = null ; } catch ( UnrecoverableEntryException une ) { if ( P11KEYSTORE . equalsIgnoreCase ( ks . getType ( ) ) || KeyStoreUtil . isWindowsKeyStore ( ks . getType ( ) ) ) { throw une ; } if ( pkey != null ) { pp = new PasswordProtection ( pkey ) ; entry = ks . getEntry ( alias , pp ) ; } else { try { pp = new PasswordProtection ( pstore ) ; entry = ks . getEntry ( alias , pp ) ; pkey = pstore ; } catch ( UnrecoverableEntryException une2 ) { if ( P12KEYSTORE . equalsIgnoreCase ( ks . getType ( ) ) ) { throw une2 ; } else { pkey = getKeyPasswd ( alias , null , null ) ; pp = new PasswordProtection ( pkey ) ; entry = ks . getEntry ( alias , pp ) ; } } } } return Pair . of ( entry , pkey ) ; }
recovers entry associated with given alias .
