public void Serialize(ref redBuffer Buffer, SteamClient Client) { Byte[] IV = new Byte[24]; Byte[] Key = new Byte[24]; Byte[] EncryptedData; // The boring stuff. Buffer.WriteUInt64(_TransactionID); Buffer.WriteUInt64(_XUID); Buffer.WriteUInt64(_Username); Buffer.WriteUInt32(_Type); Buffer.WriteUInt32(_Seed); Buffer.WriteUInt32(_IP); // Generate the IV and key. IV = SteamCrypto.CalculateIV(_Seed); Key = SteamCrypto.CalculateIV(Client.SessionID); // Resize the buffers to keep 3DES happy. Array.Resize <Byte>(ref IV, 8); Array.Resize <Byte>(ref _Data, _Data.Length + (8 - _Data.Length % 8)); // Create a new buffer and encrypt the data. EncryptedData = new Byte[_Data.Length]; EncryptedData = SteamCrypto.Encrypt(_Data, Key, IV); // Write the encrypted data to the packet. Buffer.WriteBlob(EncryptedData); }
public static Byte[] QuickMessage(UInt64 TransactionID, UInt32 Type, String Data, SteamClient Client) { NetworkPacket NewPacket = new NetworkPacket(); redBuffer NewBuffer = new redBuffer(); NewBuffer.WriteBlob(Encoding.ASCII.GetBytes(Data)); NewPacket.CreatePacket(TransactionID, Type, NewBuffer, Client); NewBuffer = new redBuffer(); NewPacket.Serialize(ref NewBuffer, Client); return NewBuffer.GetBuffer(); }
public static Byte[] QuickMessage(UInt64 TransactionID, UInt32 Type, String Data, SteamClient Client) { NetworkPacket NewPacket = new NetworkPacket(); redBuffer NewBuffer = new redBuffer(); NewBuffer.WriteBlob(Encoding.ASCII.GetBytes(Data)); NewPacket.CreatePacket(TransactionID, Type, NewBuffer, Client); NewBuffer = new redBuffer(); NewPacket.Serialize(ref NewBuffer, Client); return(NewBuffer.GetBuffer()); }
public bool Deserialize(redBuffer Buffer) { try { Buffer.WriteUInt64(IM.FromXUID); Buffer.WriteUInt64(IM.ToXUID); Buffer.WriteUInt32(IM.TimeStamp); Buffer.WriteBlob(IM.Message); } catch (Exception e) { Log.Error(e.Message); return false; } return true; }
public bool Deserialize(redBuffer Buffer) { try { Buffer.WriteUInt64(IM.FromXUID); Buffer.WriteUInt64(IM.ToXUID); Buffer.WriteUInt32(IM.TimeStamp); Buffer.WriteBlob(IM.Message); } catch (Exception e) { Log.Error(e.Message); return(false); } return(true); }
public void Serialize(ref redBuffer Buffer, SteamClient Client) { Byte[] IV = new Byte[24]; Byte[] Key = new Byte[24]; Byte[] EncryptedData; // The boring stuff. Buffer.WriteUInt64(_TransactionID); Buffer.WriteUInt64(_XUID); Buffer.WriteUInt64(_Username); Buffer.WriteUInt32(_Type); Buffer.WriteUInt32(_Seed); Buffer.WriteUInt32(_IP); // Generate the IV and key. IV = SteamCrypto.CalculateIV(_Seed); Key = SteamCrypto.CalculateIV(Client.SessionID); // Resize the buffers to keep 3DES happy. Array.Resize<Byte>(ref IV, 8); Array.Resize<Byte>(ref _Data, _Data.Length + (8 - _Data.Length % 8)); // Create a new buffer and encrypt the data. EncryptedData = new Byte[_Data.Length]; EncryptedData = SteamCrypto.Encrypt(_Data, Key, IV); // Write the encrypted data to the packet. Buffer.WriteBlob(EncryptedData); }