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

Method GetColumnEncryptor

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

Source from the content-addressed store, hash-verified

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