diff --git a/src/Libraries/Core/src/Extension/StringExtensions.cs b/src/Libraries/Core/src/Extension/StringExtensions.cs index 14915bdc2..d3210365e 100755 --- a/src/Libraries/Core/src/Extension/StringExtensions.cs +++ b/src/Libraries/Core/src/Extension/StringExtensions.cs @@ -1,3 +1,4 @@ +using System.Numerics; using System; using System.Collections.Generic; using System.IO; @@ -210,12 +211,11 @@ public static bool CheckResponseValidation(this byte[] buffer) /// public static byte[] FromHexStringToBytes(this string hex) { - return Enumerable.Range(0, hex.Length) + var data = Enumerable.Range(0, hex.Length) .Where(x => x % 2 == 0) .Select(x => Convert.ToByte(hex.Substring(x, 2), 16)) .ToArray(); + return data; } - - } } diff --git a/src/Servers/WebServer/src/Application/ClientInfo.cs b/src/Servers/WebServer/src/Application/ClientInfo.cs index 7b4f8ddfd..cc34657e0 100644 --- a/src/Servers/WebServer/src/Application/ClientInfo.cs +++ b/src/Servers/WebServer/src/Application/ClientInfo.cs @@ -13,12 +13,18 @@ namespace UniSpy.Server.WebServer.Application /// public sealed class ClientInfo : ClientInfoBase { - /// - /// RandomNumber - /// public const string PeerKeyExponent = "000001"; public const string PeerKeyModulus = "aefb5064bbd1eb632fa8d57aab1c49366ce0ee3161cbef19f2b7971b63b811790ecbf6a47b34c55f65a0766b40c261c5d69c394cd320842dd2bccba883d30eae8fdba5d03b21b09bfc600dcb30b1b2f3fbe8077630b006dcb54c4254f14891762f72e7bbfe743eb8baf65f9e8c8d11ebe46f6b59e986b4c394cfbc2c8606e29f"; /// + /// The exponent generated for user + /// exponent is 000001 + /// + public static readonly byte PeerKeyExponentByte = 1; + /// + /// The modulus generated for user aefb5064bbd1eb632fa8d57aab1c49366ce0ee3161cbef19f2b7971b63b811790ecbf6a47b34c55f65a0766b40c261c5d69c394cd320842dd2bccba883d30eae8fdba5d03b21b09bfc600dcb30b1b2f3fbe8077630b006dcb54c4254f14891762f72e7bbfe743eb8baf65f9e8c8d11ebe46f6b59e986b4c394cfbc2c8606e29f + /// + public static readonly byte[] PeerKeyModulusBytes = { 0xAE, 0xFB, 0x50, 0x64, 0xBB, 0xD1, 0xEB, 0x63, 0x2F, 0xA8, 0xD5, 0x7A, 0xAB, 0x1C, 0x49, 0x36, 0x6C, 0xE0, 0xEE, 0x31, 0x61, 0xCB, 0xEF, 0x19, 0xF2, 0xB7, 0x97, 0x1B, 0x63, 0xB8, 0x11, 0x79, 0x0E, 0xCB, 0xF6, 0xA4, 0x7B, 0x34, 0xC5, 0x5F, 0x65, 0xA0, 0x76, 0x6B, 0x40, 0xC2, 0x61, 0xC5, 0xD6, 0x9C, 0x39, 0x4C, 0xD3, 0x20, 0x84, 0x2D, 0xD2, 0xBC, 0xCB, 0xA8, 0x83, 0xD3, 0x0E, 0xAE, 0x8F, 0xDB, 0xA5, 0xD0, 0x3B, 0x21, 0xB0, 0x9B, 0xFC, 0x60, 0x0D, 0xCB, 0x30, 0xB1, 0xB2, 0xF3, 0xFB, 0xE8, 0x07, 0x76, 0x30, 0xB0, 0x06, 0xDC, 0xB5, 0x4C, 0x42, 0x54, 0xF1, 0x48, 0x91, 0x76, 0x2F, 0x72, 0xE7, 0xBB, 0xFE, 0x74, 0x3E, 0xB8, 0xBA, 0xF6, 0x5F, 0x9E, 0x8C, 0x8D, 0x11, 0xEB, 0xE4, 0x6F, 0x6B, 0x59, 0xE9, 0x86, 0xB4, 0xC3, 0x94, 0xCF, 0xBC, 0x2C, 0x86, 0x06, 0xE2, 0x9F }; + /// /// should be 256 characters /// public const string ServerData = diff --git a/src/Servers/WebServer/src/Module/Auth/Abstraction/LoginResponseBase.cs b/src/Servers/WebServer/src/Module/Auth/Abstraction/LoginResponseBase.cs index 0c2900b45..30f4df63e 100644 --- a/src/Servers/WebServer/src/Module/Auth/Abstraction/LoginResponseBase.cs +++ b/src/Servers/WebServer/src/Module/Auth/Abstraction/LoginResponseBase.cs @@ -49,9 +49,8 @@ protected void BuildContext() dataToHash.AddRange(Encoding.ASCII.GetBytes(_result.UniqueNick)); dataToHash.AddRange(Encoding.ASCII.GetBytes(_result.CdKeyHash)); - // if these 2 value be 0 we do not need to add them to the list - // dataToHash.AddRange(ClientInfo.PeerKeyPublicModulus.FromHexStringToBytes()); - // dataToHash.AddRange(ClientInfo.PeerKeyPrivate.FromHexStringToBytes()); + dataToHash.AddRange(ClientInfo.PeerKeyModulusBytes); + dataToHash.Add(ClientInfo.PeerKeyExponentByte); // server data should be convert to bytes[128] then added to list dataToHash.AddRange(ClientInfo.ServerData.FromHexStringToBytes());