Core: Updated to 11.0.7
Port From (https://github.com/TrinityCore/TrinityCore/commit/4f7079f471401d5cf7885351baabc027813f60f5)
This commit is contained in:
@@ -53,7 +53,7 @@ namespace Game.Networking.Packets
|
||||
_worldPacket.WriteUInt8(DosZeroBits);
|
||||
}
|
||||
|
||||
public byte[] Challenge = new byte[16];
|
||||
public byte[] Challenge = new byte[32];
|
||||
public byte[] DosChallenge = new byte[32]; // Encryption seeds
|
||||
public byte DosZeroBits;
|
||||
}
|
||||
@@ -83,7 +83,7 @@ namespace Game.Networking.Packets
|
||||
public uint RegionID;
|
||||
public uint BattlegroupID;
|
||||
public uint RealmID;
|
||||
public Array<byte> LocalChallenge = new(16);
|
||||
public Array<byte> LocalChallenge = new(32);
|
||||
public byte[] Digest = new byte[24];
|
||||
public ulong DosResponse;
|
||||
public string RealmJoinTicket;
|
||||
@@ -288,7 +288,9 @@ namespace Game.Networking.Packets
|
||||
hash.Process((uint)Payload.Where.Type);
|
||||
hash.Finish(BitConverter.GetBytes(Payload.Port));
|
||||
|
||||
Payload.Signature = RsaCrypt.RSA.SignHash(hash.Digest, HashAlgorithmName.SHA256, RSASignaturePadding.Pkcs1).Reverse().ToArray();
|
||||
var signHash = RsaCrypt.RSA.SignHash(hash.Digest, HashAlgorithmName.SHA256, RSASignaturePadding.Pkcs1);
|
||||
signHash.Reverse();
|
||||
Payload.Signature = signHash;
|
||||
|
||||
_worldPacket.WriteBytes(Payload.Signature, (uint)Payload.Signature.Length);
|
||||
_worldPacket.WriteBytes(whereBuffer);
|
||||
@@ -341,7 +343,7 @@ namespace Game.Networking.Packets
|
||||
|
||||
public ulong DosResponse;
|
||||
public ulong Key;
|
||||
public byte[] LocalChallenge = new byte[16];
|
||||
public byte[] LocalChallenge = new byte[32];
|
||||
public byte[] Digest = new byte[24];
|
||||
}
|
||||
|
||||
@@ -372,7 +374,8 @@ namespace Game.Networking.Packets
|
||||
bool Enabled;
|
||||
static byte[] expandedPrivateKey;
|
||||
|
||||
static byte[] EnableEncryptionSeed = { 0x90, 0x9C, 0xD0, 0x50, 0x5A, 0x2C, 0x14, 0xDD, 0x5C, 0x2C, 0xC0, 0x64, 0x14, 0xF3, 0xFE, 0xC9 };
|
||||
static byte[] EnableEncryptionSeed = { 0x66, 0xBE, 0x29, 0x79, 0xEF, 0xF2, 0xD5, 0xB5, 0x61, 0x53, 0xF6, 0x5F, 0x45, 0xAE, 0x81, 0xCB,
|
||||
0x32, 0xEC, 0x94, 0xEC, 0x75, 0xB3, 0x5F, 0x44, 0x6A, 0x63, 0x43, 0x67, 0x17, 0x20, 0x44, 0x34 };
|
||||
static byte[] EnableEncryptionContext = { 0xA7, 0x1F, 0xB6, 0x9B, 0xC9, 0x7C, 0xDD, 0x96, 0xE9, 0xBB, 0xB8, 0x21, 0x39, 0x8D, 0x5A, 0xD4 };
|
||||
|
||||
static byte[] EnterEncryptedModePrivateKey =
|
||||
@@ -396,7 +399,7 @@ namespace Game.Networking.Packets
|
||||
|
||||
public override void Write()
|
||||
{
|
||||
HmacSha256 toSign = new(EncryptionKey);
|
||||
HmacSha512 toSign = new(EncryptionKey);
|
||||
toSign.Process(BitConverter.GetBytes(Enabled), 1);
|
||||
toSign.Finish(EnableEncryptionSeed, 16);
|
||||
|
||||
|
||||
@@ -100,6 +100,7 @@ namespace Game.Networking.Packets
|
||||
_worldPacket.WriteBits(Channel.GetByteCount(), 7);
|
||||
_worldPacket.WriteBits(ChannelWelcomeMsg.GetByteCount(), 11);
|
||||
_worldPacket.WriteUInt32((uint)ChannelFlags);
|
||||
_worldPacket.WriteUInt8(Unknown1107);
|
||||
_worldPacket.WriteInt32(ChatChannelID);
|
||||
_worldPacket.WriteUInt64(InstanceID);
|
||||
_worldPacket.WritePackedGuid(ChannelGUID);
|
||||
@@ -113,6 +114,7 @@ namespace Game.Networking.Packets
|
||||
public ChannelFlags ChannelFlags;
|
||||
public string Channel = "";
|
||||
public ObjectGuid ChannelGUID;
|
||||
public byte Unknown1107;
|
||||
}
|
||||
|
||||
public class ChannelNotifyLeft : ServerPacket
|
||||
|
||||
@@ -849,9 +849,18 @@ namespace Game.Networking.Packets
|
||||
|
||||
public class LogoutComplete : ServerPacket
|
||||
{
|
||||
SwitchGameModeData SwitchGameMode;
|
||||
|
||||
public LogoutComplete() : base(ServerOpcodes.LogoutComplete) { }
|
||||
|
||||
public override void Write() { }
|
||||
public override void Write()
|
||||
{
|
||||
_worldPacket.WriteBit(SwitchGameMode != null);
|
||||
_worldPacket.FlushBits();
|
||||
|
||||
if (SwitchGameMode != null)
|
||||
SwitchGameMode.Write(_worldPacket);
|
||||
}
|
||||
}
|
||||
|
||||
public class LogoutCancel : ClientPacket
|
||||
@@ -1323,4 +1332,56 @@ namespace Game.Networking.Packets
|
||||
member.Write(data);
|
||||
}
|
||||
}
|
||||
|
||||
class GameModeData
|
||||
{
|
||||
public int Unknown_1107_0;
|
||||
public ObjectGuid Guid;
|
||||
public byte GameMode;
|
||||
public int MapID = 0;
|
||||
public byte Unknown_1107_1;
|
||||
public byte Unknown_1107_2;
|
||||
public byte Unknown_1107_3;
|
||||
public Array<ChrCustomizationChoice> Customizations = new(250);
|
||||
public Array<ChrCustomizationChoice> Unknown_1107_4 = new(250);
|
||||
|
||||
public void Write(WorldPacket data)
|
||||
{
|
||||
data.WriteInt32(Unknown_1107_0);
|
||||
data.WritePackedGuid(Guid);
|
||||
data.WriteUInt8(GameMode);
|
||||
data.WriteInt32(MapID);
|
||||
data.WriteUInt8(Unknown_1107_1);
|
||||
data.WriteUInt8(Unknown_1107_2);
|
||||
data.WriteUInt8(Unknown_1107_3);
|
||||
data.WriteInt32(Customizations.Count);
|
||||
data.WriteInt32(Unknown_1107_4.Count);
|
||||
|
||||
foreach (ChrCustomizationChoice customization in Customizations)
|
||||
{
|
||||
data.WriteUInt32(customization.ChrCustomizationOptionID);
|
||||
data.WriteUInt32(customization.ChrCustomizationChoiceID);
|
||||
}
|
||||
|
||||
foreach (ChrCustomizationChoice customization in Unknown_1107_4)
|
||||
{
|
||||
data.WriteUInt32(customization.ChrCustomizationOptionID);
|
||||
data.WriteUInt32(customization.ChrCustomizationChoiceID);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class SwitchGameModeData
|
||||
{
|
||||
public bool IsFastLogin;
|
||||
public GameModeData Current;
|
||||
public GameModeData New;
|
||||
|
||||
public void Write(WorldPacket data)
|
||||
{
|
||||
data.WriteBits(IsFastLogin, 1);
|
||||
Current.Write(data);
|
||||
New.Write(data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -704,7 +704,7 @@ namespace Game.Networking.Packets
|
||||
data.WriteBit(VotePassed);
|
||||
data.WriteBit(MyVoteCompleted);
|
||||
data.WriteBit(MyVote);
|
||||
data.WriteBits(Reason.GetByteCount(), 8);
|
||||
data.WriteBits(Reason.GetByteCount(), 9);
|
||||
data.WritePackedGuid(Target);
|
||||
data.WriteUInt32(TotalVotes);
|
||||
data.WriteUInt32(BootVotes);
|
||||
|
||||
@@ -585,18 +585,21 @@ namespace Game.Networking.Packets
|
||||
|
||||
public class StandStateChange : ClientPacket
|
||||
{
|
||||
public UnitStandStateType StandState;
|
||||
|
||||
public StandStateChange(WorldPacket packet) : base(packet) { }
|
||||
|
||||
public override void Read()
|
||||
{
|
||||
StandState = (UnitStandStateType)_worldPacket.ReadUInt32();
|
||||
StandState = (UnitStandStateType)_worldPacket.ReadUInt8();
|
||||
}
|
||||
|
||||
public UnitStandStateType StandState;
|
||||
}
|
||||
|
||||
public class StandStateUpdate : ServerPacket
|
||||
{
|
||||
uint AnimKitID;
|
||||
UnitStandStateType State;
|
||||
|
||||
public StandStateUpdate(UnitStandStateType state, uint animKitId) : base(ServerOpcodes.StandStateUpdate)
|
||||
{
|
||||
State = state;
|
||||
@@ -605,12 +608,9 @@ namespace Game.Networking.Packets
|
||||
|
||||
public override void Write()
|
||||
{
|
||||
_worldPacket.WriteUInt32(AnimKitID);
|
||||
_worldPacket.WriteUInt8((byte)State);
|
||||
_worldPacket.WriteUInt32(AnimKitID);
|
||||
}
|
||||
|
||||
uint AnimKitID;
|
||||
UnitStandStateType State;
|
||||
}
|
||||
|
||||
public class SetAnimTier : ServerPacket
|
||||
@@ -630,6 +630,13 @@ namespace Game.Networking.Packets
|
||||
|
||||
public class StartMirrorTimer : ServerPacket
|
||||
{
|
||||
public MirrorTimerType Timer;
|
||||
public int Scale;
|
||||
public int MaxValue;
|
||||
public int SpellID;
|
||||
public int Value;
|
||||
public bool Paused;
|
||||
|
||||
public StartMirrorTimer(MirrorTimerType timer, int value, int maxValue, int scale, int spellID, bool paused) : base(ServerOpcodes.StartMirrorTimer)
|
||||
{
|
||||
Timer = timer;
|
||||
@@ -642,7 +649,7 @@ namespace Game.Networking.Packets
|
||||
|
||||
public override void Write()
|
||||
{
|
||||
_worldPacket.WriteInt32((int)Timer);
|
||||
_worldPacket.WriteUInt8((byte)Timer);
|
||||
_worldPacket.WriteInt32(Value);
|
||||
_worldPacket.WriteInt32(MaxValue);
|
||||
_worldPacket.WriteInt32(Scale);
|
||||
@@ -650,17 +657,13 @@ namespace Game.Networking.Packets
|
||||
_worldPacket.WriteBit(Paused);
|
||||
_worldPacket.FlushBits();
|
||||
}
|
||||
|
||||
public int Scale;
|
||||
public int MaxValue;
|
||||
public MirrorTimerType Timer;
|
||||
public int SpellID;
|
||||
public int Value;
|
||||
public bool Paused;
|
||||
}
|
||||
|
||||
public class PauseMirrorTimer : ServerPacket
|
||||
{
|
||||
public MirrorTimerType Timer;
|
||||
public bool Paused = true;
|
||||
|
||||
public PauseMirrorTimer(MirrorTimerType timer, bool paused) : base(ServerOpcodes.PauseMirrorTimer)
|
||||
{
|
||||
Timer = timer;
|
||||
@@ -669,17 +672,16 @@ namespace Game.Networking.Packets
|
||||
|
||||
public override void Write()
|
||||
{
|
||||
_worldPacket.WriteInt32((int)Timer);
|
||||
_worldPacket.WriteUInt8((byte)Timer);
|
||||
_worldPacket.WriteBit(Paused);
|
||||
_worldPacket.FlushBits();
|
||||
}
|
||||
|
||||
public bool Paused = true;
|
||||
public MirrorTimerType Timer;
|
||||
}
|
||||
|
||||
public class StopMirrorTimer : ServerPacket
|
||||
{
|
||||
public MirrorTimerType Timer;
|
||||
|
||||
public StopMirrorTimer(MirrorTimerType timer) : base(ServerOpcodes.StopMirrorTimer)
|
||||
{
|
||||
Timer = timer;
|
||||
@@ -687,10 +689,8 @@ namespace Game.Networking.Packets
|
||||
|
||||
public override void Write()
|
||||
{
|
||||
_worldPacket.WriteInt32((int)Timer);
|
||||
_worldPacket.WriteUInt8((byte)Timer);
|
||||
}
|
||||
|
||||
public MirrorTimerType Timer;
|
||||
}
|
||||
|
||||
public class ExplorationExperience : ServerPacket
|
||||
|
||||
@@ -10,12 +10,13 @@ namespace Game.Networking.Packets
|
||||
public int BattlePetSpeciesID;
|
||||
public int TransmogSetID;
|
||||
public int ItemModifiedAppearanceID;
|
||||
public int Field_14;
|
||||
public int Field_18;
|
||||
public int TransmogIllusionID;
|
||||
public int ToyID;
|
||||
public int Price;
|
||||
public int OriginalPrice;
|
||||
public long AvailableUntil;
|
||||
public bool Disabled;
|
||||
public bool Field_41;
|
||||
public bool DoesNotExpire;
|
||||
|
||||
public void Write(WorldPacket data)
|
||||
{
|
||||
@@ -24,12 +25,13 @@ namespace Game.Networking.Packets
|
||||
data.WriteInt32(BattlePetSpeciesID);
|
||||
data.WriteInt32(TransmogSetID);
|
||||
data.WriteInt32(ItemModifiedAppearanceID);
|
||||
data.WriteInt32(Field_14);
|
||||
data.WriteInt32(Field_18);
|
||||
data.WriteInt32(TransmogIllusionID);
|
||||
data.WriteInt32(ToyID);
|
||||
data.WriteInt32(Price);
|
||||
data.WriteInt32(OriginalPrice);
|
||||
data.WriteInt64(AvailableUntil);
|
||||
data.WriteBit(Disabled);
|
||||
data.WriteBit(Field_41);
|
||||
data.WriteBit(DoesNotExpire);
|
||||
data.FlushBits();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -90,7 +90,8 @@ namespace Game.Networking.Packets
|
||||
_worldPacket.WriteUInt16(CreatureFamily);
|
||||
_worldPacket.WriteUInt16(Specialization);
|
||||
_worldPacket.WriteUInt32(TimeLimit);
|
||||
_worldPacket.WriteUInt16((ushort)((byte)CommandState | (Flag << 16)));
|
||||
_worldPacket.WriteUInt8((byte)CommandState);
|
||||
_worldPacket.WriteUInt8(Flag);
|
||||
_worldPacket.WriteUInt8((byte)ReactState);
|
||||
|
||||
foreach (uint actionButton in ActionButtons)
|
||||
@@ -362,7 +363,8 @@ namespace Game.Networking.Packets
|
||||
public override void Write()
|
||||
{
|
||||
_worldPacket.WritePackedGuid(PetGUID);
|
||||
_worldPacket.WriteUInt16((ushort)((int)CommandState | Flag << 8));
|
||||
_worldPacket.WriteUInt8((byte)CommandState);
|
||||
_worldPacket.WriteUInt8(Flag);
|
||||
_worldPacket.WriteUInt8((byte)ReactState);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -297,11 +297,11 @@ namespace Game.Networking.Packets
|
||||
data.WriteInt32(StaticType);
|
||||
data.WriteUInt32(Muid);
|
||||
|
||||
data.WriteBits(Title.GetByteCount(), 7);
|
||||
data.WriteBits(Title.GetByteCount(), 8);
|
||||
data.WriteBits(BodyText.GetByteCount(), 12);
|
||||
|
||||
for (byte i = 0; i < Choicetext.Length; i++)
|
||||
data.WriteBits(Choicetext[i].GetByteCount(), 6);
|
||||
data.WriteBits(Choicetext[i].GetByteCount(), 7);
|
||||
|
||||
data.FlushBits();
|
||||
|
||||
|
||||
@@ -95,20 +95,20 @@ namespace Game.Networking.Packets
|
||||
_worldPacket.WriteBit(SellAllJunkEnabled);
|
||||
|
||||
_worldPacket.WriteBit(GroupFinderEnabled);
|
||||
_worldPacket.WriteBit(LfdEnabled);
|
||||
_worldPacket.WriteBit(LfrEnabled);
|
||||
_worldPacket.WriteBit(IsPremadeGroupEnabled);
|
||||
_worldPacket.WriteBit(PremadeGroupsEnabled);
|
||||
_worldPacket.WriteBit(UseActivePlayerDataQuestCompleted);
|
||||
_worldPacket.WriteBit(false); // unused 10.2.7
|
||||
_worldPacket.WriteBit(GuildEventsEditsEnabled);
|
||||
_worldPacket.WriteBit(GuildTradeSkillsEnabled);
|
||||
|
||||
_worldPacket.WriteBits(Unknown1027.GetByteCount(), 7);
|
||||
_worldPacket.WriteBit(BNSendWhisperUseV2Services);
|
||||
|
||||
_worldPacket.WriteBit(BNSendGameDataUseV2Services);
|
||||
_worldPacket.WriteBit(IsAccountCurrencyTransferEnabled);
|
||||
|
||||
_worldPacket.WriteBit(false); // unused 11.0.7
|
||||
_worldPacket.WriteBit(LobbyMatchmakerQueueFromMainlineEnabled);
|
||||
_worldPacket.WriteBit(CanSendLobbyMatchmakerPartyCustomizations);
|
||||
|
||||
_worldPacket.FlushBits();
|
||||
|
||||
{
|
||||
@@ -207,15 +207,15 @@ namespace Game.Networking.Packets
|
||||
public bool IsPlayerContentTrackingEnabled;
|
||||
public bool SellAllJunkEnabled;
|
||||
public bool GroupFinderEnabled = true; // classic only
|
||||
public bool LfdEnabled = true; // classic only
|
||||
public bool LfrEnabled = true; // classic only
|
||||
public bool IsPremadeGroupEnabled = true; // classic only
|
||||
public bool PremadeGroupsEnabled = true;
|
||||
public bool UseActivePlayerDataQuestCompleted = false; ///< Uses ActivePlayerData::QuestCompleted (legacy) to store completed quest bits instead of ActivePlayerData::BitVectors[9]
|
||||
public bool GuildEventsEditsEnabled = true;
|
||||
public bool GuildTradeSkillsEnabled = true;
|
||||
public bool BNSendWhisperUseV2Services = true; ///< BNSendWhisper will send to v2.WhisperService instead of v1.NotificationService
|
||||
public bool BNSendGameDataUseV2Services = true; ///< BNSendGameData will send to v2.NotificationService instead of v1.NotificationService
|
||||
public bool IsAccountCurrencyTransferEnabled;
|
||||
public bool LobbyMatchmakerQueueFromMainlineEnabled;
|
||||
public bool CanSendLobbyMatchmakerPartyCustomizations;
|
||||
|
||||
public SocialQueueConfig QuickJoinConfig;
|
||||
public SquelchInfo Squelch;
|
||||
@@ -487,11 +487,13 @@ namespace Game.Networking.Packets
|
||||
{
|
||||
public int Rule;
|
||||
public int Value;
|
||||
public float ValueF;
|
||||
|
||||
public void Write(WorldPacket data)
|
||||
{
|
||||
data.WriteInt32(Rule);
|
||||
data.WriteInt32(Value);
|
||||
data.WriteFloat(ValueF);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -54,9 +54,13 @@ namespace Game.Networking.Packets
|
||||
|
||||
_worldPacket.WriteBits(c.Url.GetByteCount(), 11);
|
||||
_worldPacket.WriteBits(c.WaitTimeOverrideMessage.GetByteCount(), 10);
|
||||
_worldPacket.WriteBits(c.Title, 24);
|
||||
_worldPacket.WriteBits(c.Description, 24);
|
||||
|
||||
_worldPacket.WriteString(c.Url);
|
||||
_worldPacket.WriteString(c.WaitTimeOverrideMessage);
|
||||
_worldPacket.WriteString(c.Title);
|
||||
_worldPacket.WriteString(c.Description);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,6 +76,8 @@ namespace Game.Networking.Packets
|
||||
public int WaitTimeOverrideMinutes;
|
||||
public string Url;
|
||||
public string WaitTimeOverrideMessage;
|
||||
public string Title;
|
||||
public string Description;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,9 @@ namespace Game.Networking.Packets
|
||||
public uint ZoneID;
|
||||
public uint WMOGroupID;
|
||||
public uint WMODoodadPlacementID;
|
||||
public float HealthPercent = 1.0f;
|
||||
public ushort RecommendedGroupSizeMin;
|
||||
public ushort RecommendedGroupSizeMax;
|
||||
|
||||
public void Write(WorldPacket data)
|
||||
{
|
||||
@@ -25,6 +28,9 @@ namespace Game.Networking.Packets
|
||||
data.WriteUInt32(ZoneID);
|
||||
data.WriteUInt32(WMOGroupID);
|
||||
data.WriteUInt32(WMODoodadPlacementID);
|
||||
data.WriteFloat(HealthPercent);
|
||||
data.WriteUInt16(RecommendedGroupSizeMin);
|
||||
data.WriteUInt16(RecommendedGroupSizeMax);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,10 +21,14 @@ namespace Game.Networking
|
||||
static readonly string ClientConnectionInitialize = "WORLD OF WARCRAFT CONNECTION - CLIENT TO SERVER - V2";
|
||||
static readonly string ServerConnectionInitialize = "WORLD OF WARCRAFT CONNECTION - SERVER TO CLIENT - V2";
|
||||
|
||||
static readonly byte[] AuthCheckSeed = { 0xC5, 0xC6, 0x98, 0x95, 0x76, 0x3F, 0x1D, 0xCD, 0xB6, 0xA1, 0x37, 0x28, 0xB3, 0x12, 0xFF, 0x8A };
|
||||
static readonly byte[] SessionKeySeed = { 0x58, 0xCB, 0xCF, 0x40, 0xFE, 0x2E, 0xCE, 0xA6, 0x5A, 0x90, 0xB8, 0x01, 0x68, 0x6C, 0x28, 0x0B };
|
||||
static readonly byte[] ContinuedSessionSeed = { 0x16, 0xAD, 0x0C, 0xD4, 0x46, 0xF9, 0x4F, 0xB2, 0xEF, 0x7D, 0xEA, 0x2A, 0x17, 0x66, 0x4D, 0x2F };
|
||||
static readonly byte[] EncryptionKeySeed = { 0xE9, 0x75, 0x3C, 0x50, 0x90, 0x93, 0x61, 0xDA, 0x3B, 0x07, 0xEE, 0xFA, 0xFF, 0x9D, 0x41, 0xB8 };
|
||||
static readonly byte[] AuthCheckSeed = { 0xDE, 0x3A, 0x2A, 0x8E, 0x6B, 0x89, 0x52, 0x66, 0x88, 0x9D, 0x7E, 0x7A, 0x77, 0x1D, 0x5D, 0x1F,
|
||||
0x4E, 0xD9, 0x0C, 0x23, 0x9B, 0xCD, 0x0E, 0xDC, 0xD2, 0xE8, 0x04, 0x3A, 0x68, 0x64, 0xC7, 0xB0 };
|
||||
static readonly byte[] SessionKeySeed = { 0xE8, 0x1E, 0x8B, 0x59, 0x27, 0x62, 0x1E, 0xAA, 0x86, 0x15, 0x18, 0xEA, 0xC0, 0xBF, 0x66, 0x8C,
|
||||
0x6D, 0xBF, 0x83, 0x93, 0xBC, 0xAA, 0x80, 0x52, 0x5B, 0x1E, 0xDC, 0x23, 0xA0, 0x12, 0xB7, 0x50 };
|
||||
static readonly byte[] ContinuedSessionSeed = { 0x56, 0x5C, 0x61, 0x9C, 0x48, 0x3A, 0x52, 0x1F, 0x61, 0x5D, 0x05, 0x49, 0xB2, 0x9A, 0x39, 0xBF,
|
||||
0x4B, 0x97, 0xB0, 0x1B, 0xF9, 0x6C, 0xDE, 0xD6, 0x80, 0x1D, 0xAB, 0x26, 0x02, 0xA9, 0x9B, 0x9D };
|
||||
static readonly byte[] EncryptionKeySeed = { 0x71, 0xC9, 0xED, 0x5A, 0xA7, 0x0E, 0x4D, 0xFF, 0x4C, 0x36, 0xA6, 0x5A, 0x3E, 0x46, 0x8A, 0x4A,
|
||||
0x5D, 0xA1, 0x48, 0xC8, 0x30, 0x47, 0x4A, 0xDE, 0xF6, 0x0D, 0x6C, 0xBE, 0x6F, 0xE4, 0x55, 0x73 };
|
||||
|
||||
static readonly int HeaderSize = 16;
|
||||
|
||||
@@ -53,10 +57,10 @@ namespace Game.Networking
|
||||
public WorldSocket(Socket socket) : base(socket)
|
||||
{
|
||||
_connectType = ConnectionType.Realm;
|
||||
_serverChallenge = Array.Empty<byte>().GenerateRandomKey(16);
|
||||
_serverChallenge = Array.Empty<byte>().GenerateRandomKey(32);
|
||||
_worldCrypt = new WorldCrypt();
|
||||
|
||||
_encryptKey = new byte[16];
|
||||
_encryptKey = new byte[32];
|
||||
|
||||
_headerBuffer = new SocketBuffer(HeaderSize);
|
||||
_packetBuffer = new SocketBuffer(0);
|
||||
@@ -504,14 +508,14 @@ namespace Game.Networking
|
||||
// For hook purposes, we get Remoteaddress at this point.
|
||||
var address = GetRemoteIpAddress();
|
||||
|
||||
Sha256 digestKeyHash = new();
|
||||
Sha512 digestKeyHash = new();
|
||||
digestKeyHash.Process(account.game.KeyData, account.game.KeyData.Length);
|
||||
digestKeyHash.Finish(clientBuildAuthKey.Key);
|
||||
|
||||
HmacSha256 hmac = new(digestKeyHash.Digest);
|
||||
HmacSha512 hmac = new(digestKeyHash.Digest);
|
||||
hmac.Process(authSession.LocalChallenge, authSession.LocalChallenge.Count);
|
||||
hmac.Process(_serverChallenge, 16);
|
||||
hmac.Finish(AuthCheckSeed, 16);
|
||||
hmac.Process(_serverChallenge, 32);
|
||||
hmac.Finish(AuthCheckSeed, AuthCheckSeed.Length);
|
||||
|
||||
// Check that Key and account name are the same on client and server
|
||||
if (!hmac.Digest.Compare(authSession.Digest))
|
||||
@@ -522,25 +526,25 @@ namespace Game.Networking
|
||||
return;
|
||||
}
|
||||
|
||||
Sha256 keyData = new();
|
||||
Sha512 keyData = new();
|
||||
keyData.Finish(account.game.KeyData);
|
||||
|
||||
HmacSha256 sessionKeyHmac = new(keyData.Digest);
|
||||
sessionKeyHmac.Process(_serverChallenge, 16);
|
||||
HmacSha512 sessionKeyHmac = new(keyData.Digest);
|
||||
sessionKeyHmac.Process(_serverChallenge, 32);
|
||||
sessionKeyHmac.Process(authSession.LocalChallenge, authSession.LocalChallenge.Count);
|
||||
sessionKeyHmac.Finish(SessionKeySeed, 16);
|
||||
sessionKeyHmac.Finish(SessionKeySeed, SessionKeySeed.Length);
|
||||
|
||||
_sessionKey = new byte[40];
|
||||
var sessionKeyGenerator = new SessionKeyGenerator256(sessionKeyHmac.Digest, 32);
|
||||
var sessionKeyGenerator = new SessionKeyGenerator512(sessionKeyHmac.Digest, 32);
|
||||
sessionKeyGenerator.Generate(_sessionKey, 40);
|
||||
|
||||
HmacSha256 encryptKeyGen = new(_sessionKey);
|
||||
HmacSha512 encryptKeyGen = new(_sessionKey);
|
||||
encryptKeyGen.Process(authSession.LocalChallenge, authSession.LocalChallenge.Count);
|
||||
encryptKeyGen.Process(_serverChallenge, 16);
|
||||
encryptKeyGen.Finish(EncryptionKeySeed, 16);
|
||||
encryptKeyGen.Process(_serverChallenge, 32);
|
||||
encryptKeyGen.Finish(EncryptionKeySeed, EncryptionKeySeed.Length);
|
||||
|
||||
// only first 16 bytes of the hmac are used
|
||||
Buffer.BlockCopy(encryptKeyGen.Digest, 0, _encryptKey, 0, 16);
|
||||
// only first 32 bytes of the hmac are used
|
||||
Buffer.BlockCopy(encryptKeyGen.Digest, 0, _encryptKey, 0, 32);
|
||||
|
||||
PreparedStatement stmt = null;
|
||||
|
||||
@@ -714,11 +718,11 @@ namespace Game.Networking
|
||||
string login = result.Read<string>(0);
|
||||
_sessionKey = result.Read<byte[]>(1);
|
||||
|
||||
HmacSha256 hmac = new(_sessionKey);
|
||||
HmacSha512 hmac = new(_sessionKey);
|
||||
hmac.Process(BitConverter.GetBytes(authSession.Key), 8);
|
||||
hmac.Process(authSession.LocalChallenge, authSession.LocalChallenge.Length);
|
||||
hmac.Process(_serverChallenge, 16);
|
||||
hmac.Finish(ContinuedSessionSeed, 16);
|
||||
hmac.Process(_serverChallenge, 32);
|
||||
hmac.Finish(ContinuedSessionSeed, ContinuedSessionSeed.Length);
|
||||
|
||||
if (!hmac.Digest.Compare(authSession.Digest))
|
||||
{
|
||||
@@ -727,13 +731,13 @@ namespace Game.Networking
|
||||
return;
|
||||
}
|
||||
|
||||
HmacSha256 encryptKeyGen = new(_sessionKey);
|
||||
HmacSha512 encryptKeyGen = new(_sessionKey);
|
||||
encryptKeyGen.Process(authSession.LocalChallenge, authSession.LocalChallenge.Length);
|
||||
encryptKeyGen.Process(_serverChallenge, 16);
|
||||
encryptKeyGen.Finish(EncryptionKeySeed, 16);
|
||||
encryptKeyGen.Process(_serverChallenge, 32);
|
||||
encryptKeyGen.Finish(EncryptionKeySeed, EncryptionKeySeed.Length);
|
||||
|
||||
// only first 16 bytes of the hmac are used
|
||||
Buffer.BlockCopy(encryptKeyGen.Digest, 0, _encryptKey, 0, 16);
|
||||
// only first 32 bytes of the hmac are used
|
||||
Buffer.BlockCopy(encryptKeyGen.Digest, 0, _encryptKey, 0, 32);
|
||||
|
||||
SendPacket(new EnterEncryptedMode(_encryptKey, true));
|
||||
await AsyncRead();
|
||||
|
||||
Reference in New Issue
Block a user