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); }
private void Process() { this.data = this.sha256.ComputeHash(WowAuthCrypto.Concatenate(new byte[][] { this.key0, this.data, this.key1 })); this.used = 0; }
public static byte[] MakeSessionKey(byte[] clientSecret, byte[] joinSecret, byte[] clientChallenge, byte[] userRouterChallenge) { SHA256 sHA256CryptoServiceProvider = new SHA256CryptoServiceProvider(); byte[] numArray = sHA256CryptoServiceProvider.ComputeHash(WowAuthCrypto.Concatenate(new byte[][] { clientSecret, joinSecret })); HMACSHA256 hMACSHA256 = new HMACSHA256(numArray); byte[] numArray1 = hMACSHA256.ComputeHash(WowAuthCrypto.Concatenate(new byte[][] { userRouterChallenge, clientChallenge, WowAuthCrypto.MAKE_SESSION_KEY_TAG })); return((new WowAuthCrypto.CryptoRandom(numArray1)).Read(40)); }
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 byte[] MakeSessionKey(byte[] clientSecret, byte[] joinSecret, byte[] clientChallenge, byte[] userRouterChallenge) { SHA256 sha = new SHA256CryptoServiceProvider(); byte[] key = sha.ComputeHash(WowAuthCrypto.Concatenate(new byte[][] { clientSecret, joinSecret })); HMACSHA256 hmacsha = new HMACSHA256(key); byte[] seed = hmacsha.ComputeHash(WowAuthCrypto.Concatenate(new byte[][] { userRouterChallenge, clientChallenge, WowAuthCrypto.MAKE_SESSION_KEY_TAG })); WowAuthCrypto.CryptoRandom cryptoRandom = new WowAuthCrypto.CryptoRandom(seed); return(cryptoRandom.Read(40)); }