public static byte[] ProveRealmJoinChallenge(byte[] clientSecret, byte[] joinSecret, byte[] clientChallenge, byte[] serverChallenge) { WowAuthCrypto.ValidateParameter(clientSecret, 32, "clientSecret"); WowAuthCrypto.ValidateParameter(joinSecret, 32, "joinSecret"); WowAuthCrypto.ValidateParameter(clientChallenge, 16, "clientChallenge"); WowAuthCrypto.ValidateParameter(serverChallenge, 16, "serverChallenge"); SHA256 sHA = new SHA256CryptoServiceProvider(); byte[] array = sHA.ComputeHash(WowAuthCrypto.Concatenate(new byte[][] { clientSecret, joinSecret })); HMACSHA256 hMACSHA = new HMACSHA256(array); byte[] array2 = hMACSHA.ComputeHash(WowAuthCrypto.Concatenate(new byte[][] { clientChallenge, serverChallenge, WowAuthCrypto.REALM_JOIN_TAG })); byte[] array3 = new byte[24]; Array.Copy(array2, array3, array3.Length); return(array3); }
public static byte[] ProveContinueSessionChallenge(byte[] sessionKey, byte[] clientChallenge, byte[] serverChallenge, ulong connectionKey) { WowAuthCrypto.ValidateParameter(sessionKey, 40, "sessionKey"); WowAuthCrypto.ValidateParameter(clientChallenge, 16, "clientChallenge"); WowAuthCrypto.ValidateParameter(serverChallenge, 16, "serverChallenge"); byte[] bytes = BitConverter.GetBytes(connectionKey); if (!BitConverter.IsLittleEndian) { Array.Reverse(bytes); } HMACSHA256 hMACSHA256 = new HMACSHA256(sessionKey); byte[] numArray = hMACSHA256.ComputeHash(WowAuthCrypto.Concatenate(new byte[][] { bytes, clientChallenge, serverChallenge, WowAuthCrypto.CONTINUE_SESSION_TAG })); byte[] numArray1 = new byte[24]; Array.Copy(numArray, numArray1, (int)numArray1.Length); return(numArray1); }
public static bool VerifyContinueSessionChallenge(byte[] proof, byte[] sessionKey, byte[] clientChallenge, byte[] serverChallenge, ulong connectionKey) { WowAuthCrypto.ValidateParameter(proof, 24, "proof"); byte[] right = WowAuthCrypto.ProveContinueSessionChallenge(sessionKey, clientChallenge, serverChallenge, connectionKey); return(WowAuthCrypto.CompareBytes(proof, right)); }
public static bool VerifyRealmJoinChallenge(byte[] proof, byte[] clientSecret, byte[] joinSecret, byte[] clientChallenge, byte[] serverChallenge) { WowAuthCrypto.ValidateParameter(proof, 24, "proof"); byte[] right = WowAuthCrypto.ProveRealmJoinChallenge(clientSecret, joinSecret, clientChallenge, serverChallenge); return(WowAuthCrypto.CompareBytes(proof, right)); }