MCPcopy Create free account
hub / github.com/ClickHouse/ClickHouse / encryptValue

Method encryptValue

src/Common/Config/ConfigProcessor.cpp:197–210  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

195#if USE_SSL
196
197std::string ConfigProcessor::encryptValue(const std::string & codec_name, const std::string & value)
198{
199 EncryptionMethod encryption_method = toEncryptionMethod(codec_name);
200 CompressionCodecEncrypted codec(encryption_method);
201
202 Memory<> memory;
203 memory.resize(codec.getCompressedReserveSize(static_cast<UInt32>(value.size())));
204 auto bytes_written = codec.compress(value.data(), static_cast<UInt32>(value.size()), memory.data());
205 std::string encrypted_value(memory.data(), bytes_written);
206 std::string hex_value;
207 /// NOLINTNEXTLINE(clang-analyzer-core.StackAddressEscape)
208 boost::algorithm::hex(encrypted_value.begin(), encrypted_value.end(), std::back_inserter(hex_value));
209 return hex_value;
210}
211
212std::string ConfigProcessor::decryptValue(const std::string & codec_name, const std::string & value)
213{

Callers

nothing calls this directly

Calls 8

toEncryptionMethodFunction · 0.85
resizeMethod · 0.45
sizeMethod · 0.45
compressMethod · 0.45
dataMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected