private void OnHelloRequest(OutgoingMessageBag outgoingMessages) { ClientHelloMessage clientHelloMessage = new ClientHelloMessage(); clientHelloMessage.RandomNumber = new byte[RandomNumberLength]; m_rng.GetBytes(clientHelloMessage.RandomNumber); SecurityParameters.ClientRandom = clientHelloMessage.RandomNumber; clientHelloMessage.CipherSuites = AllowedCipherSuites; NetMQMessage outgoingMessage = clientHelloMessage.ToNetMQMessage(); HashLocalAndRemote(outgoingMessage); outgoingMessages.AddHandshakeMessage(outgoingMessage); m_lastSentMessage = HandshakeType.ClientHello; }
private void OnClientHello(NetMQMessage incomingMessage, OutgoingMessageBag outgoingMessages) { if (m_lastReceivedMessage != HandshakeType.HelloRequest || m_lastSentMessage != HandshakeType.HelloRequest) { throw new NetMQSecurityException(NetMQSecurityErrorCode.HandshakeUnexpectedMessage, "Client Hello received when expecting another message"); } HashLocalAndRemote(incomingMessage); ClientHelloMessage clientHelloMessage = new ClientHelloMessage(); clientHelloMessage.SetFromNetMQMessage(incomingMessage); SecurityParameters.ClientRandom = clientHelloMessage.RandomNumber; AddServerHelloMessage(outgoingMessages, clientHelloMessage.CipherSuites); AddCertificateMessage(outgoingMessages); AddServerHelloDone(outgoingMessages); }