private byte[] receivedClientKeyExchange(PSKClientKeyExchange message) throws HandshakeException {
  clientKeyExchange=message;
  String identity=message.getIdentity();
  byte[] psk=pskStore.getKey(identity);
  LOGGER.log(Level.FINER,"Client [{0}] uses PSK identity [{1}]",new Object[]{getPeerAddress(),identity});
  if (psk == null) {
    throw new HandshakeException(String.format("Cannot authenticate client, identity [%s] is unknown",identity),new AlertMessage(AlertLevel.FATAL,AlertDescription.HANDSHAKE_FAILURE,session.getPeer()));
  }
  session.setPeerIdentity(new PreSharedKeyIdentity(identity));
  return generatePremasterSecretFromPSK(psk);
}

private byte [ ] receivedClientKeyExchange ( PSKClientKeyExchange message ) throws HandshakeException { clientKeyExchange = message ; String identity = message . getIdentity ( ) ; byte [ ] psk = pskStore . getKey ( identity ) ; LOGGER . log ( Level . FINER , "Client [{0}] uses PSK identity [{1}]" , new Object [ ] { getPeerAddress ( ) , identity } ) ; if ( psk == null ) { throw new HandshakeException ( String . format ( "Cannot authenticate client, identity [%s] is unknown" , identity ) , new AlertMessage ( AlertLevel . FATAL , AlertDescription . HANDSHAKE_FAILURE , session . getPeer ( ) ) ) ; } session . setPeerIdentity ( new PreSharedKeyIdentity ( identity ) ) ; return generatePremasterSecretFromPSK ( psk ) ; }
retrieves the preshared key from the identity hint and then generates the premaster secret .
