diff options
Diffstat (limited to 'src/server/shared/Cryptography')
-rw-r--r-- | src/server/shared/Cryptography/Authentication/WorldPacketCrypt.cpp | 15 | ||||
-rw-r--r-- | src/server/shared/Cryptography/Authentication/WorldPacketCrypt.h | 1 |
2 files changed, 11 insertions, 5 deletions
diff --git a/src/server/shared/Cryptography/Authentication/WorldPacketCrypt.cpp b/src/server/shared/Cryptography/Authentication/WorldPacketCrypt.cpp index 69198c18df0..b84de24741c 100644 --- a/src/server/shared/Cryptography/Authentication/WorldPacketCrypt.cpp +++ b/src/server/shared/Cryptography/Authentication/WorldPacketCrypt.cpp @@ -29,12 +29,17 @@ WorldPacketCrypt::WorldPacketCrypt() : PacketCrypt(SHA_DIGEST_LENGTH) void WorldPacketCrypt::Init(BigNumber* K) { uint8 ServerEncryptionKey[SEED_KEY_SIZE] = { 0x08, 0xF1, 0x95, 0x9F, 0x47, 0xE5, 0xD2, 0xDB, 0xA1, 0x3D, 0x77, 0x8F, 0x3F, 0x3E, 0xE7, 0x00 }; - HmacSha1 serverEncryptHmac(SEED_KEY_SIZE, (uint8*)ServerEncryptionKey); - uint8 *encryptHash = serverEncryptHmac.ComputeHash(K); - uint8 ServerDecryptionKey[SEED_KEY_SIZE] = { 0x40, 0xAA, 0xD3, 0x92, 0x26, 0x71, 0x43, 0x47, 0x3A, 0x31, 0x08, 0xA6, 0xE7, 0xDC, 0x98, 0x2A }; - HmacSha1 clientDecryptHmac(SEED_KEY_SIZE, (uint8*)ServerDecryptionKey); - uint8 *decryptHash = clientDecryptHmac.ComputeHash(K); + Init(K, ServerEncryptionKey, ServerDecryptionKey); +} + +void WorldPacketCrypt::Init(BigNumber* k, uint8 const* serverKey, uint8 const* clientKey) +{ + HmacSha1 serverEncryptHmac(SEED_KEY_SIZE, (uint8*)serverKey); + uint8 *encryptHash = serverEncryptHmac.ComputeHash(k); + + HmacSha1 clientDecryptHmac(SEED_KEY_SIZE, (uint8*)clientKey); + uint8 *decryptHash = clientDecryptHmac.ComputeHash(k); _clientDecrypt.Init(decryptHash); _serverEncrypt.Init(encryptHash); diff --git a/src/server/shared/Cryptography/Authentication/WorldPacketCrypt.h b/src/server/shared/Cryptography/Authentication/WorldPacketCrypt.h index 7ccca11f09d..58c4003418e 100644 --- a/src/server/shared/Cryptography/Authentication/WorldPacketCrypt.h +++ b/src/server/shared/Cryptography/Authentication/WorldPacketCrypt.h @@ -29,6 +29,7 @@ class WorldPacketCrypt : public PacketCrypt WorldPacketCrypt(); void Init(BigNumber* K) override; + void Init(BigNumber* k, uint8 const* serverKey, uint8 const* clientKey); }; #endif // _WORLDPACKETCRYPT_H |