diff --git a/src/rsa.cpp b/src/rsa.cpp index ba557ac..b382313 100644 --- a/src/rsa.cpp +++ b/src/rsa.cpp @@ -31,9 +31,13 @@ static CryptoPP::AutoSeededRandomPool prng; void RSA::decrypt(char* msg) const { - CryptoPP::Integer m{ reinterpret_cast(msg), 128 }; - auto c = pk.CalculateInverse(prng, m); - c.Encode(reinterpret_cast(msg), 128); + try { + CryptoPP::Integer m{ reinterpret_cast(msg), 128 }; + auto c = pk.CalculateInverse(prng, m); + c.Encode(reinterpret_cast(msg), 128); + } + catch (const CryptoPP::Exception& e) { + } } static const std::string header = "-----BEGIN RSA PRIVATE KEY-----";