Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Toggle main menu visibility
Loading...
Searching...
No Matches
AuthCrypt.cpp
Go to the documentation of this file.
1
/*
2
* This file is part of Project SkyFire https://www.projectskyfire.org.
3
* See LICENSE.md file for Copyright information
4
*/
5
6
#include "
AuthCrypt.h
"
7
#include "
Errors.h
"
8
#include "
HMAC.h
"
9
10
AuthCrypt::AuthCrypt
() :
_initialized
(false)
11
{
12
}
13
14
15
void
AuthCrypt::Init
(
SessionKey
const
& K)
16
{
17
uint8
ServerEncryptionKey[] = { 0x08, 0xF1, 0x95, 0x9F, 0x47, 0xE5, 0xD2, 0xDB, 0xA1, 0x3D, 0x77, 0x8F, 0x3F, 0x3E, 0xE7, 0x00 };
18
_serverEncrypt
.Init(
SkyFire::Crypto::HMAC_SHA1::GetDigestOf
(ServerEncryptionKey, K));
19
uint8
ServerDecryptionKey[] = { 0x40, 0xAA, 0xD3, 0x92, 0x26, 0x71, 0x43, 0x47, 0x3A, 0x31, 0x08, 0xA6, 0xE7, 0xDC, 0x98, 0x2A };
20
_clientDecrypt
.Init(
SkyFire::Crypto::HMAC_SHA1::GetDigestOf
(ServerDecryptionKey, K));
21
22
// Drop first 1024 bytes, as WoW uses ARC4-drop1024.
23
std::array<uint8, 1024> syncBuf;
24
_serverEncrypt
.UpdateData(syncBuf);
25
_clientDecrypt
.UpdateData(syncBuf);
26
27
_initialized
=
true
;
28
}
29
30
void
AuthCrypt::DecryptRecv
(
uint8
*data,
size_t
len)
31
{
32
ASSERT
(
_initialized
);
33
_clientDecrypt
.UpdateData(data, len);
34
}
35
36
void
AuthCrypt::EncryptSend
(
uint8
*data,
size_t
len)
37
{
38
ASSERT
(
_initialized
);
39
_serverEncrypt
.UpdateData(data, len);
40
}
AuthCrypt.h
SessionKey
std::array< uint8, SESSION_KEY_LENGTH > SessionKey
Definition
AuthDefines.h:8
uint8
std::uint8_t uint8
Definition
Define.h:79
Errors.h
ASSERT
#define ASSERT
Definition
Errors.h:29
HMAC.h
AuthCrypt::AuthCrypt
AuthCrypt()
Definition
AuthCrypt.cpp:10
AuthCrypt::_clientDecrypt
SkyFire::Crypto::ARC4 _clientDecrypt
Definition
AuthCrypt.h:25
AuthCrypt::EncryptSend
void EncryptSend(uint8 *data, size_t len)
Definition
AuthCrypt.cpp:36
AuthCrypt::_initialized
bool _initialized
Definition
AuthCrypt.h:27
AuthCrypt::Init
void Init(SessionKey const &K)
Definition
AuthCrypt.cpp:15
AuthCrypt::_serverEncrypt
SkyFire::Crypto::ARC4 _serverEncrypt
Definition
AuthCrypt.h:26
AuthCrypt::DecryptRecv
void DecryptRecv(uint8 *data, size_t len)
Definition
AuthCrypt.cpp:30
SkyFire::Impl::GenericHMAC< EVP_sha1, Constants::SHA1_DIGEST_LENGTH_BYTES >::GetDigestOf
static Digest GetDigestOf(Container const &seed, uint8 const *data, size_t len)
Definition
HMAC.h:40
src
server
shared
Cryptography
Authentication
AuthCrypt.cpp
Generated on
for Project SkyFire Core by
1.17.0