AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
AuthCrypt Class Reference

#include "AuthCrypt.h"

Public Member Functions

 AuthCrypt ()=default
 
void Init (SessionKey const &K)
 
void DecryptRecv (uint8 *data, std::size_t len)
 
void EncryptSend (uint8 *data, std::size_t len)
 
bool IsInitialized () const
 

Private Attributes

Acore::Crypto::ARC4 _clientDecrypt
 
Acore::Crypto::ARC4 _serverEncrypt
 
bool _initialized { false }
 

Detailed Description

Constructor & Destructor Documentation

◆ AuthCrypt()

AuthCrypt::AuthCrypt ( )
default

Member Function Documentation

◆ DecryptRecv()

void AuthCrypt::DecryptRecv ( uint8 data,
std::size_t  len 
)
39{
41 _clientDecrypt.UpdateData(data, len);
42}
#define ASSERT
Definition: Errors.h:68
void UpdateData(uint8 *data, std::size_t len)
Definition: ARC4.cpp:44
bool _initialized
Definition: AuthCrypt.h:38
Acore::Crypto::ARC4 _clientDecrypt
Definition: AuthCrypt.h:36

References _clientDecrypt, _initialized, ASSERT, and Acore::Crypto::ARC4::UpdateData().

Referenced by WorldSocket::ReadHeaderHandler().

◆ EncryptSend()

void AuthCrypt::EncryptSend ( uint8 data,
std::size_t  len 
)
45{
47 _serverEncrypt.UpdateData(data, len);
48}
Acore::Crypto::ARC4 _serverEncrypt
Definition: AuthCrypt.h:37

References _initialized, _serverEncrypt, ASSERT, and Acore::Crypto::ARC4::UpdateData().

Referenced by WorldSocket::Update().

◆ Init()

void AuthCrypt::Init ( SessionKey const &  K)
23{
24 uint8 ServerEncryptionKey[] = { 0xCC, 0x98, 0xAE, 0x04, 0xE8, 0x97, 0xEA, 0xCA, 0x12, 0xDD, 0xC0, 0x93, 0x42, 0x91, 0x53, 0x57 };
26
27 uint8 ServerDecryptionKey[] = { 0xC2, 0xB3, 0x72, 0x3C, 0xC6, 0xAE, 0xD9, 0xB5, 0x34, 0x3C, 0x53, 0xEE, 0x2F, 0x43, 0x67, 0xCE };
29
30 // Drop first 1024 bytes, as WoW uses ARC4-drop1024.
31 std::array<uint8, 1024> syncBuf{};
34
35 _initialized = true;
36}
std::uint8_t uint8
Definition: Define.h:109
void Init(uint8 const *seed, std::size_t len)
Definition: ARC4.cpp:36
static Digest GetDigestOf(Container const &seed, uint8 const *data, std::size_t len)
Definition: HMAC.h:40

References _clientDecrypt, _initialized, _serverEncrypt, Acore::Impl::GenericHMAC< HashCreator, DigestLength >::GetDigestOf(), Acore::Crypto::ARC4::Init(), and Acore::Crypto::ARC4::UpdateData().

Referenced by WorldSocket::HandleAuthSessionCallback().

◆ IsInitialized()

bool AuthCrypt::IsInitialized ( ) const
inline

Member Data Documentation

◆ _clientDecrypt

Acore::Crypto::ARC4 AuthCrypt::_clientDecrypt
private

Referenced by DecryptRecv(), and Init().

◆ _initialized

bool AuthCrypt::_initialized { false }
private

Referenced by DecryptRecv(), EncryptSend(), and Init().

◆ _serverEncrypt

Acore::Crypto::ARC4 AuthCrypt::_serverEncrypt
private

Referenced by EncryptSend(), and Init().