public final Key doPhase(Key key,boolean lastPhase) throws InvalidKeyException, IllegalStateException {
  chooseFirstProvider();
  return spi.engineDoPhase(key,lastPhase);
}

public final Key doPhase ( Key key , boolean lastPhase ) throws InvalidKeyException , IllegalStateException { chooseFirstProvider ( ) ; return spi . engineDoPhase ( key , lastPhase ) ; }
executes the next phase of this key agreement with the given key that was received from one of the other parties involved in this key agreement .
