Skip to content

Add AES_GCM_CTR_V1 encryption support for Parquet - #2478

Open
Jack1007 wants to merge 1 commit into
apache:masterfrom
Jack1007:ctr-support-dev
Open

Add AES_GCM_CTR_V1 encryption support for Parquet#2478
Jack1007 wants to merge 1 commit into
apache:masterfrom
Jack1007:ctr-support-dev

Conversation

@Jack1007

Copy link
Copy Markdown

Which issue does this PR close?

Closes #2477

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-rs and 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,
+}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add AES_GCM_CTR_V1 encryption support for Parquet

2 participants