Add AES_GCM_CTR_V1 encryption support for Parquet - #2478
Open
Jack1007 wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds support for reading/writing Parquet files encrypted with the AES_GCM_CTR_V1 algorithm by introducing an upstream arrow-rs patch that uses AES-GCM for metadata modules and AES-CTR for page data (via aws-lc-rs), enabling Auron to interoperate with CTR-encrypted Parquet tables (Issue #2477).
Changes:
- Extends Parquet modular encryption to support
AES_GCM_CTR_V1, separating page data vs metadata encryption/decryption paths. - Introduces AES-CTR block encryptor/decryptor implemented with
aws-lc-rsand wires it through file/page encryption plumbing. - Updates Parquet encryption tests to validate successful reads instead of asserting
NYI.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+150
to
+164
| + fn decrypt(&self, length_and_ciphertext: &[u8], _aad: &[u8]) -> Result<Vec<u8>> { | ||
| + let nonce: [u8; NONCE_LEN] = length_and_ciphertext[SIZE_LEN..SIZE_LEN + NONCE_LEN] | ||
| + .try_into() | ||
| + .map_err(|_| General("Invalid nonce length".to_string()))?; | ||
| + let iv = build_ctr_iv(&nonce); | ||
| + | ||
| + let mut result = length_and_ciphertext[SIZE_LEN + NONCE_LEN..].to_vec(); | ||
| + let context = aws_lc_rs::cipher::DecryptionContext::Iv128( | ||
| + aws_lc_rs::iv::FixedLength::<CTR_IV_LEN>::from(iv), | ||
| + ); | ||
| + self.key | ||
| + .decrypt(&mut result, context) | ||
| + .map_err(|_| General("CTR decryption failed".to_string()))?; | ||
| + Ok(result) | ||
| + } |
Comment on lines
+171
to
+175
| +#[derive(Debug, Clone)] | ||
| +pub(crate) struct CtrBlockEncryptor { | ||
| + key: Arc<aws_lc_rs::cipher::EncryptingKey>, | ||
| + nonce_sequence: CounterNonce, | ||
| +} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
Closes #2477