2022-10-03 10:06:54 +00:00
|
|
|
#include <Common/Documentation.h>
|
|
|
|
#include <Common/config.h>
|
|
|
|
|
|
|
|
#if USE_SSL
|
|
|
|
|
|
|
|
# include <Functions/FunctionFactory.h>
|
|
|
|
# include <Functions/FunctionsAES.h>
|
|
|
|
|
|
|
|
namespace
|
|
|
|
{
|
|
|
|
|
|
|
|
struct TryDecryptImpl
|
|
|
|
{
|
|
|
|
static constexpr auto name = "tryDecrypt";
|
|
|
|
static constexpr auto compatibility_mode = OpenSSLDetails::CompatibilityMode::OpenSSL;
|
|
|
|
static constexpr bool use_null_when_decrypt_fail = true;
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace DB
|
|
|
|
{
|
|
|
|
|
2022-10-03 10:46:20 +00:00
|
|
|
REGISTER_FUNCTION(TryDecrypt)
|
2022-10-03 10:06:54 +00:00
|
|
|
{
|
2022-10-04 06:56:46 +00:00
|
|
|
factory.registerFunction<FunctionDecrypt<TryDecryptImpl>>(Documentation(
|
|
|
|
"Similar to `decrypt`, but returns NULL if decryption fails because of using the wrong key."));
|
2022-10-03 10:06:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|