adamreeve commented on code in PR #7111: URL: https://github.com/apache/arrow-rs/pull/7111#discussion_r2002341357
########## parquet/src/file/metadata/writer.rs: ########## @@ -182,6 +258,95 @@ impl<'a, W: Write> ThriftMetadataWriter<'a, W> { self.key_value_metadata = Some(key_value_metadata); self } + + #[cfg(feature = "encryption")] + pub fn with_file_encryptor(mut self, file_encryptor: Option<Arc<FileEncryptor>>) -> Self { + self.file_encryptor = file_encryptor; + self + } + + #[cfg(feature = "encryption")] + fn file_crypto_metadata( + file_encryptor: &Arc<FileEncryptor>, + ) -> Result<crate::format::FileCryptoMetaData> { + let properties = file_encryptor.properties(); + let supply_aad_prefix = properties + .aad_prefix() + .map(|_| !properties.store_aad_prefix()); + let encryption_algorithm = AesGcmV1 { + aad_prefix: properties.aad_prefix().cloned(), Review Comment: We shouldn't set `aad_prefix` here unless `properties.store_aad_prefix()` is true. (I think this is my mistake!) We should also add a test that we can't read a file written with `store_aad_prefix = false` unless the AAD prefix is passed. When reading, I guess we could check `supply_aad_prefix` as an indication that an AAD prefix is expected and raise a more helpful error if one isn't supplied, but that's probably out of scope for this PR. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org