| 461 | } |
| 462 | |
| 463 | void CloseEncryptedFile(FileEncryptionProperties* file_encryption_properties) { |
| 464 | // Encrypted file with encrypted footer |
| 465 | if (file_encryption_properties->encrypted_footer()) { |
| 466 | // encrypted footer |
| 467 | file_metadata_ = metadata_->Finish(key_value_metadata_); |
| 468 | |
| 469 | PARQUET_ASSIGN_OR_THROW(int64_t position, sink_->Tell()); |
| 470 | uint64_t metadata_start = static_cast<uint64_t>(position); |
| 471 | auto crypto_metadata = metadata_->GetCryptoMetaData(); |
| 472 | WriteFileCryptoMetaData(*crypto_metadata, sink_.get()); |
| 473 | |
| 474 | auto footer_encryptor = file_encryptor_->GetFooterEncryptor(); |
| 475 | WriteEncryptedFileMetadata(*file_metadata_, sink_.get(), footer_encryptor, true); |
| 476 | PARQUET_ASSIGN_OR_THROW(position, sink_->Tell()); |
| 477 | uint32_t footer_and_crypto_len = static_cast<uint32_t>(position - metadata_start); |
| 478 | uint32_t footer_and_crypto_len_le = |
| 479 | ::arrow::bit_util::ToLittleEndian(footer_and_crypto_len); |
| 480 | PARQUET_THROW_NOT_OK( |
| 481 | sink_->Write(reinterpret_cast<uint8_t*>(&footer_and_crypto_len_le), 4)); |
| 482 | PARQUET_THROW_NOT_OK(sink_->Write(kParquetEMagic, 4)); |
| 483 | } else { // Encrypted file with plaintext footer |
| 484 | file_metadata_ = metadata_->Finish(key_value_metadata_); |
| 485 | auto footer_signing_encryptor = file_encryptor_->GetFooterSigningEncryptor(); |
| 486 | WriteEncryptedFileMetadata(*file_metadata_, sink_.get(), footer_signing_encryptor, |
| 487 | false); |
| 488 | } |
| 489 | } |
| 490 | |
| 491 | void WritePageIndex() { |
| 492 | if (page_index_builder_ != nullptr) { |
nothing calls this directly
no test coverage detected