예제 #1
0
        private void OnAuthChallenge(SvAuthChallenge msg)
        {
            sessionKey = asymCp.Decrypt(msg.SessionKey);
            var respond = new ClAuthRespond {
                Login = login, Password = password
            };

            Send(respond);
        }
예제 #2
0
        private void OnClPublicKeyRespond(ClPublicKeyRespond msg, ClientId id)
        {
            var cl = clients[id];

            asymCp.SetKey(msg.Key);
            var encryptedKey = asymCp.Encrypt(cl.SessionKey);
            var challenge    = new SvAuthChallenge {
                SessionKey = encryptedKey
            };

            if (!SendTo(id, challenge))
            {
                return;
            }
            cl.Secure = true;
        }
예제 #3
0
        public void SaveLoadSvAuthChallenge()
        {
            // arrange
            byte[] refSessionKey = { 88, 10, 42, 98, 61, 210, 99, 65, 88, 1, 24, 89, 61, 201, 99, 56 };
            var    msg           = new SvAuthChallenge
            {
                SessionKey = refSessionKey,
            };

            // act
            MultiprotocolSaveLoad(msg, () =>
            {
                // assert
                Assert.AreEqual(msg.SessionKey, refSessionKey);
            });
        }