2023-04-28 10:10:42 +00:00
|
|
|
#include <Common/FunctionDocumentation.h>
|
2022-10-06 07:54:38 +00:00
|
|
|
#include "config.h"
|
2022-10-03 10:06:54 +00:00
|
|
|
|
|
|
|
#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
|
|
|
{
|
2023-04-28 10:10:42 +00:00
|
|
|
factory.registerFunction<FunctionDecrypt<TryDecryptImpl>>(FunctionDocumentation{
|
|
|
|
.description="Similar to `decrypt`, but returns NULL if decryption fails because of using the wrong key."});
|
2022-10-03 10:06:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|