fix crash bug on decrypt with invalid rsa on the client side

This commit is contained in:
ErikasKontenis 2020-01-29 18:19:01 +02:00
parent 51c4d22aa8
commit 2b877cd03c

View File

@ -31,9 +31,13 @@ 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-----";