public GameCrypto HandleClientKeyPacket(string PublicKey, GameCrypto cryptographer) { byte[] key = _keyExchange.ComputeKey(OpenSSL.BigNumber.FromHexString(PublicKey)); cryptographer.SetKey(key); cryptographer.SetIvs(_clientIv, _serverIv); return(cryptographer); }
public static bool HandleExchange(GameCrypto Crypto, ProjectX_V3_Lib.Network.SocketClient sClient, ProjectX_V3_Lib.Network.DataPacket Packet) { try { byte[] packet = Packet.Copy(); ushort position = 7; uint PacketLen = BitConverter.ToUInt32(packet, position); position += 4; int JunkLen = BitConverter.ToInt32(packet, position); position += 4; position += (ushort)JunkLen; int Len = BitConverter.ToInt32(packet, position); position += 4; byte[] pubKey = new byte[Len]; for (int x = 0; x < Len; x++) pubKey[x] = packet[x + position]; string PubKey = pubKey.GetString(); // System.Text.ASCIIEncoding.ASCII.GetString(pubKey); Crypto = Crypto.DHKeySequence.HandleClientKeyPacket(PubKey, Crypto); Crypto.Exchanged = true; return true; } catch { return false; } }
public GameCrypto HandleClientKeyPacket(string PublicKey, GameCrypto cryptographer) { byte[] key = _keyExchange.ComputeKey(OpenSSL.BigNumber.FromHexString(PublicKey)); cryptographer.SetKey(key); cryptographer.SetIvs(_clientIv, _serverIv); return cryptographer; }
public static bool HandleExchange(GameCrypto Crypto, ProjectX_V3_Lib.Network.SocketClient sClient, ProjectX_V3_Lib.Network.DataPacket Packet) { try { byte[] packet = Packet.Copy(); ushort position = 7; uint PacketLen = BitConverter.ToUInt32(packet, position); position += 4; int JunkLen = BitConverter.ToInt32(packet, position); position += 4; position += (ushort)JunkLen; int Len = BitConverter.ToInt32(packet, position); position += 4; byte[] pubKey = new byte[Len]; for (int x = 0; x < Len; x++) { pubKey[x] = packet[x + position]; } string PubKey = pubKey.GetString(); // System.Text.ASCIIEncoding.ASCII.GetString(pubKey); Crypto = Crypto.DHKeySequence.HandleClientKeyPacket(PubKey, Crypto); Crypto.Exchanged = true; return(true); } catch { return(false); } }