mirror of
https://github.com/edubart/otclient.git
synced 2025-10-18 05:23:26 +02:00
rework on dat and spr loader
This commit is contained in:
@@ -23,25 +23,6 @@ Rsa::~Rsa()
|
||||
mpz_clear(m_mod);
|
||||
}
|
||||
|
||||
bool Rsa::setKey(const std::string& file)
|
||||
{
|
||||
//loads p,q and d from a file
|
||||
FILE* f = fopen(file.c_str(), "r");
|
||||
if(!f){
|
||||
return false;
|
||||
}
|
||||
|
||||
char p[512];
|
||||
char q[512];
|
||||
char d[512];
|
||||
delete fgets(p, 512, f);
|
||||
delete fgets(q, 512, f);
|
||||
delete fgets(d, 512, f);
|
||||
|
||||
setKey(p, q, d);
|
||||
return true;
|
||||
}
|
||||
|
||||
void Rsa::setKey(const char* p, const char* q, const char* d)
|
||||
{
|
||||
mpz_set_str(m_p, p, 10);
|
||||
|
@@ -9,8 +9,8 @@ class Rsa
|
||||
public:
|
||||
Rsa();
|
||||
~Rsa();
|
||||
|
||||
void setKey(const char* p, const char* q, const char* d);
|
||||
bool setKey(const std::string& file);
|
||||
bool decrypt(char* msg, int32_t size);
|
||||
static bool encrypt(char* msg, int32_t size, const char* key);
|
||||
|
||||
@@ -20,6 +20,4 @@ protected:
|
||||
mpz_t m_p, m_q, m_u, m_d, m_dp, m_dq, m_mod;
|
||||
};
|
||||
|
||||
typedef std::shared_ptr<Rsa> RsaPtr;
|
||||
|
||||
#endif //RSA_H
|
||||
#endif
|
Reference in New Issue
Block a user