mirror of
https://github.com/edubart/otclient.git
synced 2025-10-16 04:24:54 +02:00
Removed GMP and added OpenSSL. Rsa class might be moved to Crypto later.
This commit is contained in:
@@ -86,10 +86,13 @@ std::string InputMessage::getString()
|
||||
return std::string(v, stringLength);
|
||||
}
|
||||
|
||||
bool InputMessage::decryptRsa(int size, const std::string& p, const std::string& q, const std::string& d)
|
||||
bool InputMessage::decryptRsa(int size, const std::string& key, const std::string& p, const std::string& q, const std::string& d)
|
||||
{
|
||||
checkRead(size);
|
||||
RSA::decrypt((char*)m_buffer + m_readPos, size, p.c_str(), q.c_str(), d.c_str());
|
||||
g_rsa.setPublic(key.c_str(), "65537");
|
||||
g_rsa.setPrivate(p.c_str(), q.c_str(), d.c_str());
|
||||
g_rsa.check();
|
||||
g_rsa.decrypt((unsigned char*)m_buffer + m_readPos, size);
|
||||
return (getU8() == 0x00);
|
||||
}
|
||||
|
||||
|
@@ -52,7 +52,7 @@ public:
|
||||
uint32 peekU32() { uint32 v = getU32(); m_readPos-=4; return v; }
|
||||
uint64 peekU64() { uint64 v = getU64(); m_readPos-=8; return v; }
|
||||
|
||||
bool decryptRsa(int size, const std::string& p, const std::string& q, const std::string& d);
|
||||
bool decryptRsa(int size, const std::string& key, const std::string& p, const std::string& q, const std::string& d);
|
||||
|
||||
int getReadSize() { return m_readPos - m_headerPos; }
|
||||
int getReadPos() { return m_readPos; }
|
||||
|
@@ -94,7 +94,8 @@ void OutputMessage::encryptRsa(int size, const std::string& key)
|
||||
if(m_messageSize < size)
|
||||
throw stdext::exception("insufficient bytes in buffer to encrypt");
|
||||
|
||||
RSA::encrypt((char*)m_buffer + m_writePos - size, size, key.c_str());
|
||||
g_rsa.setPublic(key.c_str(), "65537");
|
||||
g_rsa.encrypt((unsigned char*)m_buffer + m_writePos - size, size);
|
||||
}
|
||||
|
||||
void OutputMessage::writeChecksum()
|
||||
|
Reference in New Issue
Block a user