diff options
Diffstat (limited to 'csgo-loader/csgo-server/Security/Encryption.cpp')
| -rw-r--r-- | csgo-loader/csgo-server/Security/Encryption.cpp | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/csgo-loader/csgo-server/Security/Encryption.cpp b/csgo-loader/csgo-server/Security/Encryption.cpp index f4681b8..b42b4ab 100644 --- a/csgo-loader/csgo-server/Security/Encryption.cpp +++ b/csgo-loader/csgo-server/Security/Encryption.cpp @@ -580,13 +580,7 @@ namespace Wrapper // Generate random bytes to use as encryption key.
if(CryptGenRandom(m_CryptProvider, RandomBytesCount, RandomBytes))
- {
- m_EncryptionKey.insert(
- m_EncryptionKey.begin(),
- RandomBytes,
- RandomBytes + RandomBytesCount
- );
- }
+ std::memcpy(m_EncryptionKey, RandomBytes, RandomBytesCount);
// Release context.
if(m_CryptProvider)
@@ -597,7 +591,7 @@ namespace Wrapper {
// If an encryption key is provided, initialise the wrapper with
// the passed parameter.
- std::copy(EncryptionKey.begin(), EncryptionKey.end(), m_EncryptionKey.begin());
+ std::copy(EncryptionKey.begin(), EncryptionKey.end(), m_EncryptionKey);
if(EncryptionKey.empty())
Start();
@@ -608,11 +602,7 @@ namespace Wrapper // Encrypt outgoing data.
ByteArray Encrypted;
- #ifdef DEBUG
- Encrypted = Data;
- #else
- Aes256::encrypt(m_EncryptionKey, Data, Encrypted);
- #endif
+ Aes256::encrypt(GetKey(), Data, Encrypted);
return Encrypted;
}
@@ -622,11 +612,7 @@ namespace Wrapper // Decrypt incoming data.
ByteArray Decrypted;
- #ifdef DEBUG
- Decrypted = Data;
- #else
- Aes256::decrypt(m_EncryptionKey, Data, Decrypted);
- #endif
+ Aes256::decrypt(GetKey(), Data, Decrypted);
return Decrypted;
}
|
