public void Bitlogin_FailedLogout_ClientSendingFakeSignature() { BitloginServer bitloginServer = new BitloginServer(Random.value); BitloginClient bitloginClient = new BitloginClient(); HiMessage hiMessage = bitloginClient.GetHiMessage(); BitloginProtocolMessage okSignThisMessage = bitloginServer.GetOkSignThisMessage(hiMessage); VerifyMeMessage verifyMeMessage = bitloginClient.GetVerifyMeMessage(okSignThisMessage as OkSignThisMessage); bitloginServer.GetAuthenticationResult(verifyMeMessage); Account.VerificationState currentClientVerificationStateInServer = bitloginServer.GetVerificationStateOfAccount(bitloginClient.LegacyAddress); Assert.IsTrue(currentClientVerificationStateInServer == Account.VerificationState.verified); LogOutRequestMessage logOutRequestMessage = bitloginClient.GetLogOutRequestMessage(); logOutRequestMessage.signature = bitloginClient.SignMessage("Wrong message to sign"); BitloginProtocolMessage logOutResponse = bitloginServer.LogOutRequest(logOutRequestMessage); Assert.IsInstanceOf <ErrorMessage>(logOutResponse); Assert.IsTrue(((ErrorMessage)logOutResponse).errorCode == 400); Account.VerificationState currentClientVerificationStateInServerAfterLogOut = bitloginServer.GetVerificationStateOfAccount(bitloginClient.LegacyAddress); Assert.IsTrue(currentClientVerificationStateInServerAfterLogOut == Account.VerificationState.verified); }
public void Bitlogin_FailedLogin_ClientTryingToVerifyBeforeHi() { BitloginClient bitloginClient = new BitloginClient(); BitloginServer bitloginServer = new BitloginServer(Random.value); string messageSignature = bitloginClient.SignMessage("Message to sign"); VerifyMeMessage verifyMeMessage = new VerifyMeMessage(bitloginClient.LegacyAddress, messageSignature, bitloginClient.PublicId); BitloginProtocolMessage authenticationResult = bitloginServer.GetAuthenticationResult(verifyMeMessage); Assert.IsInstanceOf <ErrorMessage>(authenticationResult, "Client sending fake signature is returning authentication success"); Assert.IsTrue((authenticationResult as ErrorMessage).errorCode == 200, "bitloginServer.GetAuthenticationResult() returning not a error code 200"); Account.VerificationState currentClientVerificationStateInServer = bitloginServer.GetVerificationStateOfAccount(bitloginClient.LegacyAddress); Assert.IsTrue(currentClientVerificationStateInServer == Account.VerificationState.unknown); }
public void Bitlogin_FailedLogin_ClientSendingASignatureOfAWrongMessage() { BitloginClient bitloginClient = new BitloginClient(); BitloginServer bitloginServer = new BitloginServer(Random.value); HiMessage hiMessage = bitloginClient.GetHiMessage(); BitloginProtocolMessage okSignThisMessage = bitloginServer.GetOkSignThisMessage(hiMessage); VerifyMeMessage verifyMeMessage = bitloginClient.GetVerifyMeMessage(okSignThisMessage as OkSignThisMessage); verifyMeMessage.signature = bitloginClient.SignMessage("this is a wrong message to be signed" + Random.value.ToString()); BitloginProtocolMessage authenticationResult = bitloginServer.GetAuthenticationResult(verifyMeMessage); Assert.IsInstanceOf <ErrorMessage>(authenticationResult, "Client sending fake signature is returning authentication success"); Assert.IsTrue((authenticationResult as ErrorMessage).errorCode == 400, "bitloginServer.GetAuthenticationResult() returning not a error code 400"); Account.VerificationState currentClientVerificationStateInServer = bitloginServer.GetVerificationStateOfAccount(bitloginClient.LegacyAddress); Assert.IsTrue(currentClientVerificationStateInServer == Account.VerificationState.unverified); }