| 478 | } |
| 479 | |
| 480 | void CloseEncryptedFile(FileEncryptionProperties* file_encryption_properties) { |
| 481 | // Encrypted file with encrypted footer |
| 482 | if (file_encryption_properties->encrypted_footer()) { |
| 483 | // encrypted footer |
| 484 | file_metadata_ = metadata_->Finish(key_value_metadata_); |
| 485 | |
| 486 | PARQUET_ASSIGN_OR_THROW(int64_t position, sink_->Tell()); |
| 487 | uint64_t metadata_start = static_cast<uint64_t>(position); |
| 488 | auto crypto_metadata = metadata_->GetCryptoMetaData(); |
| 489 | WriteFileCryptoMetaData(*crypto_metadata, sink_.get()); |
| 490 | |
| 491 | auto footer_encryptor = file_encryptor_->GetFooterEncryptor(); |
| 492 | WriteEncryptedFileMetadata(*file_metadata_, sink_.get(), footer_encryptor, true); |
| 493 | PARQUET_ASSIGN_OR_THROW(position, sink_->Tell()); |
| 494 | uint32_t footer_and_crypto_len = static_cast<uint32_t>(position - metadata_start); |
| 495 | uint32_t footer_and_crypto_len_le = |
| 496 | ::arrow::bit_util::ToLittleEndian(footer_and_crypto_len); |
| 497 | PARQUET_THROW_NOT_OK( |
| 498 | sink_->Write(reinterpret_cast<uint8_t*>(&footer_and_crypto_len_le), 4)); |
| 499 | PARQUET_THROW_NOT_OK(sink_->Write(kParquetEMagic, 4)); |
| 500 | } else { // Encrypted file with plaintext footer |
| 501 | file_metadata_ = metadata_->Finish(key_value_metadata_); |
| 502 | auto footer_signing_encryptor = file_encryptor_->GetFooterSigningEncryptor(); |
| 503 | WriteEncryptedFileMetadata(*file_metadata_, sink_.get(), footer_signing_encryptor, |
| 504 | false); |
| 505 | } |
| 506 | } |
| 507 | |
| 508 | void WritePageIndex() { |
| 509 | if (page_index_builder_ != nullptr) { |
nothing calls this directly
no test coverage detected