rok commented on code in PR #6637:
URL: https://github.com/apache/arrow-rs/pull/6637#discussion_r1888441586
##########
parquet/src/file/serialized_reader.rs:
##########
@@ -338,14 +341,38 @@ impl<R: 'static + ChunkReader> RowGroupReader for
SerializedRowGroupReader<'_, R
}
/// Reads a [`PageHeader`] from the provided [`Read`]
-pub(crate) fn read_page_header<T: Read>(input: &mut T) -> Result<PageHeader> {
+pub(crate) fn read_page_header<T: Read>(input: &mut T, crypto_context:
Option<Arc<CryptoContext>>) -> Result<PageHeader> {
let mut prot = TCompactInputProtocol::new(input);
+ if let Some(crypto_context) = crypto_context {
+ // let mut buf = [0; 16 * 1024];
+ // let size = input.read(&mut buf)?;
+
+ let decryptor = &crypto_context.data_decryptor();
+ let file_decryptor = decryptor.footer_decryptor();
+ let aad_file_unique = decryptor.aad_file_unique();
+ // let aad_prefix = decryptor.aad_prefix();
+
+ let aad = create_page_aad(
+ aad_file_unique.as_slice(),
+ ModuleType::DictionaryPageHeader,
+ crypto_context.row_group_ordinal,
+ crypto_context.column_ordinal,
+ 0,
+ )?;
+
+ // todo: This currently fails, possibly due to wrongly generated AAD
+ let buf = file_decryptor.decrypt(prot.read_bytes()?.as_slice(),
aad.as_ref());
Review Comment:
Thanks @adamreeve! That was indeed the issue! :)
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]