private void OnAuthChallenge(SvAuthChallenge msg) { sessionKey = asymCp.Decrypt(msg.SessionKey); var respond = new ClAuthRespond { Login = login, Password = password }; Send(respond); }
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; }
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); }); }