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

Method FileEncryptionProperties

cpp/src/parquet/encryption/encryption.cc:300–333  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

298}
299
300FileEncryptionProperties::FileEncryptionProperties(
301 ParquetCipher::type cipher, SecureString footer_key, std::string footer_key_metadata,
302 bool encrypted_footer, std::string aad_prefix, bool store_aad_prefix_in_file,
303 ColumnPathToEncryptionPropertiesMap encrypted_columns)
304 : footer_key_(std::move(footer_key)),
305 footer_key_metadata_(std::move(footer_key_metadata)),
306 encrypted_footer_(encrypted_footer),
307 aad_prefix_(std::move(aad_prefix)),
308 store_aad_prefix_in_file_(store_aad_prefix_in_file),
309 encrypted_columns_(std::move(encrypted_columns)) {
310 DCHECK(!footer_key_.empty());
311 // footer_key must be either 16, 24 or 32 bytes.
312 DCHECK(footer_key_.length() == 16 || footer_key_.length() == 24 ||
313 footer_key_.length() == 32);
314
315 uint8_t aad_file_unique[kAadFileUniqueLength];
316 encryption::RandBytes(aad_file_unique, kAadFileUniqueLength);
317 std::string aad_file_unique_str(reinterpret_cast<const char*>(aad_file_unique),
318 kAadFileUniqueLength);
319
320 bool supply_aad_prefix = false;
321 if (aad_prefix_.empty()) {
322 file_aad_ = aad_file_unique_str;
323 } else {
324 file_aad_ = aad_prefix_ + aad_file_unique_str;
325 if (!store_aad_prefix_in_file_) supply_aad_prefix = true;
326 }
327 algorithm_.algorithm = cipher;
328 algorithm_.aad.aad_file_unique = aad_file_unique_str;
329 algorithm_.aad.supply_aad_prefix = supply_aad_prefix;
330 if (!aad_prefix_.empty() && store_aad_prefix_in_file_) {
331 algorithm_.aad.aad_prefix = aad_prefix_;
332 }
333}
334
335} // namespace parquet

Callers

nothing calls this directly

Calls 3

RandBytesFunction · 0.70
emptyMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected