TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
WorldPacketCrypt Class Reference

#include <WorldPacketCrypt.h>

Public Member Functions

 WorldPacketCrypt ()
 
void Init (BigNumber *K) override
 
void Init (BigNumber *k, uint8 const *serverKey, uint8 const *clientKey)
 
- Public Member Functions inherited from PacketCrypt
 PacketCrypt (uint32 rc4InitSize)
 
virtual ~PacketCrypt ()
 
void DecryptRecv (uint8 *data, size_t length)
 
void EncryptSend (uint8 *data, size_t length)
 
bool IsInitialized () const
 

Additional Inherited Members

- Protected Attributes inherited from PacketCrypt
ARC4 _clientDecrypt
 
ARC4 _serverEncrypt
 
bool _initialized
 

Constructor & Destructor Documentation

WorldPacketCrypt::WorldPacketCrypt ( )
25  : PacketCrypt(SHA_DIGEST_LENGTH)
26 {
27 }
PacketCrypt(uint32 rc4InitSize)
Definition: PacketCrypt.cpp:20

Member Function Documentation

void WorldPacketCrypt::Init ( BigNumber K)
overridevirtual

Implements PacketCrypt.

30 {
31  uint8 ServerEncryptionKey[SEED_KEY_SIZE] = { 0x08, 0xF1, 0x95, 0x9F, 0x47, 0xE5, 0xD2, 0xDB, 0xA1, 0x3D, 0x77, 0x8F, 0x3F, 0x3E, 0xE7, 0x00 };
32  uint8 ServerDecryptionKey[SEED_KEY_SIZE] = { 0x40, 0xAA, 0xD3, 0x92, 0x26, 0x71, 0x43, 0x47, 0x3A, 0x31, 0x08, 0xA6, 0xE7, 0xDC, 0x98, 0x2A };
33  Init(K, ServerEncryptionKey, ServerDecryptionKey);
34 }
void Init(BigNumber *K) override
Definition: WorldPacketCrypt.cpp:29
#define SEED_KEY_SIZE
Definition: HmacHash.h:29
uint8_t uint8
Definition: Define.h:152

+ Here is the caller graph for this function:

void WorldPacketCrypt::Init ( BigNumber k,
uint8 const serverKey,
uint8 const clientKey 
)
37 {
38  HmacSha1 serverEncryptHmac(SEED_KEY_SIZE, (uint8*)serverKey);
39  uint8 *encryptHash = serverEncryptHmac.ComputeHash(k);
40 
41  HmacSha1 clientDecryptHmac(SEED_KEY_SIZE, (uint8*)clientKey);
42  uint8 *decryptHash = clientDecryptHmac.ComputeHash(k);
43 
44  _clientDecrypt.Init(decryptHash);
45  _serverEncrypt.Init(encryptHash);
46 
47  // Drop first 1024 bytes, as WoW uses ARC4-drop1024.
48  uint8 syncBuf[1024];
49  memset(syncBuf, 0, 1024);
50 
51  _serverEncrypt.UpdateData(1024, syncBuf);
52 
53  memset(syncBuf, 0, 1024);
54 
55  _clientDecrypt.UpdateData(1024, syncBuf);
56 
57  _initialized = true;
58 }
bool _initialized
Definition: PacketCrypt.h:40
Definition: HmacHash.h:34
void Init(uint8 *seed)
Definition: ARC4.cpp:42
ARC4 _serverEncrypt
Definition: PacketCrypt.h:39
#define SEED_KEY_SIZE
Definition: HmacHash.h:29
ARC4 _clientDecrypt
Definition: PacketCrypt.h:38
uint8_t uint8
Definition: Define.h:152
void UpdateData(int len, uint8 *data)
Definition: ARC4.cpp:47

+ Here is the call graph for this function:


The documentation for this class was generated from the following files: