mirror of
https://github.com/edubart/otclient.git
synced 2025-12-15 13:19:46 +01:00
Add flexibility in login packets
* It's now possible to add custom data in the login packet * Add utility funciton to generate RSA keys * Make the protocol able to use RSA keys with 2048 bits or more
This commit is contained in:
@@ -89,12 +89,14 @@ void OutputMessage::addPaddingBytes(int bytes, uint8 byte)
|
||||
m_messageSize += bytes;
|
||||
}
|
||||
|
||||
void OutputMessage::encryptRsa(int size)
|
||||
void OutputMessage::encryptRsa()
|
||||
{
|
||||
int size = g_crypt.rsaGetSize();
|
||||
if(m_messageSize < size)
|
||||
throw stdext::exception("insufficient bytes in buffer to encrypt");
|
||||
|
||||
g_crypt.rsaEncrypt((unsigned char*)m_buffer + m_writePos - size, size);
|
||||
if(!g_crypt.rsaEncrypt((unsigned char*)m_buffer + m_writePos - size, size))
|
||||
throw stdext::exception("rsa encryption failed");
|
||||
}
|
||||
|
||||
void OutputMessage::writeChecksum()
|
||||
|
||||
@@ -49,7 +49,7 @@ public:
|
||||
void addString(const std::string& buffer);
|
||||
void addPaddingBytes(int bytes, uint8 byte = 0);
|
||||
|
||||
void encryptRsa(int size);
|
||||
void encryptRsa();
|
||||
|
||||
uint16 getWritePos() { return m_writePos; }
|
||||
uint16 getMessageSize() { return m_messageSize; }
|
||||
|
||||
Reference in New Issue
Block a user