diff --git a/services/tunnelbroker/docker-server/contents/server/src/Tools/CryptoTools.cpp b/services/tunnelbroker/docker-server/contents/server/src/Tools/CryptoTools.cpp index 7e7f8a1ae..0fa344ea4 100644 --- a/services/tunnelbroker/docker-server/contents/server/src/Tools/CryptoTools.cpp +++ b/services/tunnelbroker/docker-server/contents/server/src/Tools/CryptoTools.cpp @@ -1,52 +1,46 @@ #include "CryptoTools.h" #include #include #include #include #include #include #include namespace comm { namespace network { namespace crypto { bool rsaVerifyString( const std::string &publicKeyBase64, const std::string &message, const std::string &signatureBase64) { - CryptoPP::RSA::PublicKey publicKey; std::string decodedSignature; - std::unique_ptr base64Decoder; - try { - base64Decoder = std::make_unique(); - publicKey.Load( - CryptoPP::StringSource(publicKeyBase64, true, base64Decoder.release()) - .Ref()); - - base64Decoder = std::make_unique( - std::make_unique(decodedSignature).release()); + publicKey.Load(CryptoPP::StringSource( + publicKeyBase64, true, new CryptoPP::Base64Decoder()) + .Ref()); CryptoPP::StringSource stringSource( - signatureBase64, true, base64Decoder.release()); - + signatureBase64, + true, + new CryptoPP::Base64Decoder( + new CryptoPP::StringSink(decodedSignature))); CryptoPP::RSASSA_PKCS1v15_SHA_Verifier verifierSha256(publicKey); return verifierSha256.VerifyMessage( reinterpret_cast(message.c_str()), message.length(), reinterpret_cast(decodedSignature.c_str()), decodedSignature.length()); - } catch (const std::exception &e) { std::cout << "CryptoTools: " << "Got an exception " << e.what() << std::endl; return false; } } } // namespace crypto } // namespace network } // namespace comm