mirror of
https://github.com/ErikasKontenis/SabrehavenServer.git
synced 2025-04-30 09:39:20 +02:00
fix crash bug on decrypt with invalid rsa on the client side
This commit is contained in:
parent
51c4d22aa8
commit
2b877cd03c
@ -31,10 +31,14 @@ static CryptoPP::AutoSeededRandomPool prng;
|
|||||||
|
|
||||||
void RSA::decrypt(char* msg) const
|
void RSA::decrypt(char* msg) const
|
||||||
{
|
{
|
||||||
|
try {
|
||||||
CryptoPP::Integer m{ reinterpret_cast<uint8_t*>(msg), 128 };
|
CryptoPP::Integer m{ reinterpret_cast<uint8_t*>(msg), 128 };
|
||||||
auto c = pk.CalculateInverse(prng, m);
|
auto c = pk.CalculateInverse(prng, m);
|
||||||
c.Encode(reinterpret_cast<uint8_t*>(msg), 128);
|
c.Encode(reinterpret_cast<uint8_t*>(msg), 128);
|
||||||
}
|
}
|
||||||
|
catch (const CryptoPP::Exception& e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static const std::string header = "-----BEGIN RSA PRIVATE KEY-----";
|
static const std::string header = "-----BEGIN RSA PRIVATE KEY-----";
|
||||||
static const std::string footer = "-----END RSA PRIVATE KEY-----";
|
static const std::string footer = "-----END RSA PRIVATE KEY-----";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user