MCPcopy Create free account
hub / github.com/apache/arrow / GetColumnEncryptor

Method GetColumnEncryptor

cpp/src/parquet/encryption/internal_file_encryptor.cc:92–127  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

90}
91
92std::shared_ptr<Encryptor>
93InternalFileEncryptor::InternalFileEncryptor::GetColumnEncryptor(
94 const std::string& column_path, bool metadata) {
95 // first look if we already got the encryptor from before
96 if (metadata) {
97 if (column_metadata_map_.find(column_path) != column_metadata_map_.end()) {
98 return column_metadata_map_.at(column_path);
99 }
100 } else {
101 if (column_data_map_.find(column_path) != column_data_map_.end()) {
102 return column_data_map_.at(column_path);
103 }
104 }
105 auto column_prop = properties_->column_encryption_properties(column_path);
106 if (column_prop == nullptr || !column_prop->is_encrypted()) {
107 return nullptr;
108 }
109
110 const SecureString& key = column_prop->is_encrypted_with_footer_key()
111 ? properties_->footer_key()
112 : column_prop->key();
113
114 ParquetCipher::type algorithm = properties_->algorithm().algorithm;
115 auto aes_encryptor = metadata ? GetMetaAesEncryptor(algorithm, key.size())
116 : GetDataAesEncryptor(algorithm, key.size());
117
118 std::string file_aad = properties_->file_aad();
119 std::shared_ptr<Encryptor> encryptor =
120 std::make_shared<Encryptor>(aes_encryptor, key, file_aad, "", pool_);
121 if (metadata)
122 column_metadata_map_[column_path] = encryptor;
123 else
124 column_data_map_[column_path] = encryptor;
125
126 return encryptor;
127}
128
129int InternalFileEncryptor::MapKeyLenToEncryptorArrayIndex(int32_t key_len) const {
130 if (key_len == 16)

Callers

nothing calls this directly

Calls 7

footer_keyMethod · 0.80
findMethod · 0.45
endMethod · 0.45
keyMethod · 0.45
algorithmMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected