Пример #1
0
        private void HandleKeyExchangeMessage(NetworkIncomingMessage message)
        {
            HandshakeKeyExchange exchange = new HandshakeKeyExchange(message);

            keys.Secret = HandshakeCryptography.Secret(credentials, exchange.Key);
            message.Acknowledge(96);

            connection.Send(new HandshakeKeyExchangeMessage(credentials));
            connection.Receive(SynchronizeCryptoHashMessage, VerifyCryptoHashMessage);
        }
Пример #2
0
        private void HandleKeyExchangeMessage(NetworkIncomingMessage message)
        {
            HandshakeKeyExchange exchange = new HandshakeKeyExchange(message);

            keys.Secret = HandshakeCryptography.Secret(credentials, exchange.Key);
            keys.Local  = new HandshakeKey(HandshakeKeyOwnership.Initiator, keys.Secret, context.Hash);
            keys.Remote = new HandshakeKey(HandshakeKeyOwnership.Receiver, keys.Secret, context.Hash);

            message.Acknowledge(96);

            connection.Send(new HandshakeCryptoHashMessage(keys.Secret, context.Hash.ToBytes()));
            connection.Send(new HandshakeCryptoPayloadMessage(2), keys.Local);
            connection.Send(new HandshakeCryptoMessage(), keys.Local);

            connection.Receive(SynchronizeCryptoMessage, VerifyCryptoMessage);
        }