Skip to content

Commit 62b8dfa

Browse files
committed
parquet: simplify encrypted bloom filter test AAD
1 parent 721567f commit 62b8dfa

1 file changed

Lines changed: 6 additions & 13 deletions

File tree

cpp/src/parquet/encryption/bloom_filter_encryption_test.cc

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
#include "parquet/platform.h"
3939
#include "parquet/test_util.h"
4040
#include "parquet/thrift_internal.h"
41-
#include "parquet/types.h"
4241

4342
namespace parquet::encryption::test {
4443
namespace {
@@ -77,16 +76,10 @@ EncryptedBloomFilterPayload BuildEncryptedBloomFilterPayload(int32_t bitset_size
7776
serializer.Serialize(&header, header_sink.get());
7877
PARQUET_ASSIGN_OR_THROW(auto header_buf, header_sink->Finish());
7978

80-
const std::string file_aad = "file_aad";
81-
const int16_t row_group_ordinal = 0;
82-
const int16_t column_ordinal = 0;
83-
// AAD must match the module type, row group, and column ordinals.
84-
const std::string header_aad =
85-
encryption::CreateModuleAad(file_aad, encryption::kBloomFilterHeader,
86-
row_group_ordinal, column_ordinal, kNonPageOrdinal);
87-
const std::string bitset_aad =
88-
encryption::CreateModuleAad(file_aad, encryption::kBloomFilterBitset,
89-
row_group_ordinal, column_ordinal, kNonPageOrdinal);
79+
// Use fixed AAD strings for the test. The encryptor and decryptor must use
80+
// the same AAD, but the exact value does not matter for unit testing Deserialize.
81+
const std::string header_aad = "test_bloom_filter_header_aad";
82+
const std::string bitset_aad = "test_bloom_filter_bitset_aad";
9083

9184
// Use fixed keys for deterministic test data.
9285
const ::arrow::util::SecureString header_key("0123456789abcdef");
@@ -134,11 +127,11 @@ EncryptedBloomFilterPayload BuildEncryptedBloomFilterPayload(int32_t bitset_size
134127
payload.header_decryptor = std::make_unique<Decryptor>(
135128
encryption::AesDecryptor::Make(ParquetCipher::AES_GCM_V1,
136129
static_cast<int32_t>(header_key.size()), true),
137-
header_key, file_aad, header_aad, ::arrow::default_memory_pool());
130+
header_key, "", header_aad, ::arrow::default_memory_pool());
138131
payload.bitset_decryptor = std::make_unique<Decryptor>(
139132
encryption::AesDecryptor::Make(ParquetCipher::AES_GCM_V1,
140133
static_cast<int32_t>(bitset_key.size()), false),
141-
bitset_key, file_aad, bitset_aad, ::arrow::default_memory_pool());
134+
bitset_key, "", bitset_aad, ::arrow::default_memory_pool());
142135

143136
return payload;
144137
}

0 commit comments

Comments
 (0)