aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/clickhouse/src/Functions/tryDecrypt.cpp
blob: bcfac22f81a31cdfe1ad5fb2c88948ecdc5a4a10 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <Common/FunctionDocumentation.h>
#include "clickhouse_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
{

REGISTER_FUNCTION(TryDecrypt)
{
    factory.registerFunction<FunctionDecrypt<TryDecryptImpl>>(FunctionDocumentation{
        .description="Similar to `decrypt`, but returns NULL if decryption fails because of using the wrong key."});
}

}

#endif