Repository navigation
Conversation
This branch has not been deployed
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?
Rationale for this change
Parquet modular encryption specifies both
AES_GCM_V1andAES_GCM_CTR_V1as well as 128-, 192-, and 256-bit AES keys. Previouslyparquetonly supportedAES_GCM_V1with 128- and 256-bit keys (viaring), returningParquetError::NYIforAES_GCM_CTR_V1files and rejecting 24-byte AES-192 keys.To add
AES_GCM_CTR_V1and AES-192 support while preservingwasm32-unknown-unknowncompatibility and avoiding a C/CMake build dependency (such asaws-lc-rs), this PR keepsringfor 128/256-bit AES-GCM and adds pure-Rustaes-gcm(0.10.3,default-features = false, features = ["aes"]) andctr(0.9.2,default-features = false) under theencryptionfeature for AES-192-GCM and AES-128/192/256-CTR.What changes are included in this PR?
aes-gcmandctrcrates to theencryptionfeature inparquet/Cargo.tomland updateparquet/README.md.parquet/src/encryption/ciphers.rs):RingGcmBlockDecryptor/RingGcmBlockEncryptorwithGcmKey/GcmBlockEncryptor, dispatching 16- and 32-byte keys toringand 24-byte keys toaes-gcm(AesGcm<Aes192, U12>).CtrKeyandCtrBlockEncryptor(reusingCounterNonce) implementing Parquet's AES-CTR framing ([4-byte LE length][12-byte nonce][ciphertext]with 16-byte IVnonce || 0x00000001and big-endian 32-bit counterCtr32BE).EncryptionPropertiesBuilder::with_aes_gcm_ctr_v1(mut self) -> Selfto configureAES_GCM_CTR_V1when writing encrypted Parquet files.DataPage,DataPageV2,DictionaryPage) withCtrBlockEncryptorinPageEncryptorwhile keeping page headers and all metadata modules encrypted with AES-GCM.EncryptionAlgorithm::AES_GCM_CTR_V1inFileDecryptor,CryptoContext,MetadataObjectWriter, andparquet_metadata_with_encryption(includingsupply_aad_prefix).SerializedPageReaderContext::read_page_headerto decrypt page headers withmetadata_decryptor()(GCM) instead ofdata_decryptor()(which is CTR underAES_GCM_CTR_V1).AesGcmV1andAesGcmCtrV1intoAesParameters.Are these changes tested?
Yes:
parquet-testingAES_GCM_CTR_V1integration tests (test_aes_ctr_encryptioninparquet/tests/encryption/encryption.rsandencryption_async.rs), replacing the previousNYIassertions with full read verification.parquet/src/encryption/ciphers.rs:nonce || 1IV over multi-block + partial-tail input.parquet/tests/encryption/encryption.rs:test_aes192_and_ctr_roundtrip: matrix over 16/24/32-byte keys,AES_GCM_V1vsAES_GCM_CTR_V1, encrypted vs plaintext footer, uniform vs column keys, multiple pages, dictionary encoding, page index, andDataPageV2.test_aes_gcm_ctr_v1_uses_ctr_for_pages_and_gcm_for_headers: verifies written CTR pages omit the 16-byte GCM tag, tampering with page headers fails GCM authentication, and tampering with page bodies behaves as unauthenticated CTR vs authenticated GCM.test_aes192_invalid_keys_and_signatures: verifies AES-192 wrong footer key, wrong AAD prefix, and wrong column key error handling.Are there any significant user-facing changes?
parquet::encryption::encrypt::EncryptionPropertiesBuilder::with_aes_gcm_ctr_v1(self) -> Self.encryptionCargo feature ofparquetnow also pulls inaes-gcmandctr(withdefault-features = false).Error creating RingGcmBlockDecryptor with unsupported key length: <len>toUnsupported AES key length: <len>(updated inparquet/tests/encryption/encryption_async.rs).AI usage disclosure
AI assistance was used for code review, refactoring CTR encryption to reuse
CounterNonce, and generating unit/integration tests (including KAT vectors verified independently against OpenSSL). All changes were reviewed and tested locally.