@@ -73,44 +73,37 @@ KeyMaterial KeyMaterial::Parse(const std::string& key_material_string) {
7373 throw ParquetException (" Wrong key material type: " + key_material_type + " vs " +
7474 kKeyMaterialType1 );
7575 }
76- // Parse other fields (common to internal and external key material)
77- return Parse (&json_parser);
78- }
7976
80- KeyMaterial KeyMaterial::Parse (const JsonObjectParser* key_material_json) {
8177 // 2. Check if "key material" belongs to file footer key
8278 bool is_footer_key;
83- PARQUET_ASSIGN_OR_THROW (is_footer_key, key_material_json-> GetBool (kIsFooterKeyField ));
79+ PARQUET_ASSIGN_OR_THROW (is_footer_key, json_parser. GetBool (kIsFooterKeyField ));
8480 std::string kms_instance_id;
8581 std::string kms_instance_url;
8682 if (is_footer_key) {
8783 // 3. For footer key, extract KMS Instance ID
88- PARQUET_ASSIGN_OR_THROW (kms_instance_id,
89- key_material_json->GetString (kKmsInstanceIdField ));
84+ PARQUET_ASSIGN_OR_THROW (kms_instance_id, json_parser.GetString (kKmsInstanceIdField ));
9085 // 4. For footer key, extract KMS Instance URL
9186 PARQUET_ASSIGN_OR_THROW (kms_instance_url,
92- key_material_json-> GetString (kKmsInstanceUrlField ));
87+ json_parser. GetString (kKmsInstanceUrlField ));
9388 }
9489 // 5. Extract master key ID
9590 std::string master_key_id;
96- PARQUET_ASSIGN_OR_THROW (master_key_id, key_material_json-> GetString (kMasterKeyIdField ));
91+ PARQUET_ASSIGN_OR_THROW (master_key_id, json_parser. GetString (kMasterKeyIdField ));
9792 // 6. Extract wrapped DEK
9893 std::string encoded_wrapped_dek;
9994 PARQUET_ASSIGN_OR_THROW (encoded_wrapped_dek,
100- key_material_json-> GetString (kWrappedDataEncryptionKeyField ));
95+ json_parser. GetString (kWrappedDataEncryptionKeyField ));
10196 std::string kek_id;
10297 std::string encoded_wrapped_kek;
10398 // 7. Check if "key material" was generated in double wrapping mode
10499 bool is_double_wrapped;
105- PARQUET_ASSIGN_OR_THROW (is_double_wrapped,
106- key_material_json->GetBool (kDoubleWrappingField ));
100+ PARQUET_ASSIGN_OR_THROW (is_double_wrapped, json_parser.GetBool (kDoubleWrappingField ));
107101 if (is_double_wrapped) {
108102 // 8. In double wrapping mode, extract KEK ID
109- PARQUET_ASSIGN_OR_THROW (kek_id,
110- key_material_json->GetString (kKeyEncryptionKeyIdField ));
103+ PARQUET_ASSIGN_OR_THROW (kek_id, json_parser.GetString (kKeyEncryptionKeyIdField ));
111104 // 9. In double wrapping mode, extract wrapped KEK
112105 PARQUET_ASSIGN_OR_THROW (encoded_wrapped_kek,
113- key_material_json-> GetString (kWrappedKeyEncryptionKeyField ));
106+ json_parser. GetString (kWrappedKeyEncryptionKeyField ));
114107 }
115108
116109 return KeyMaterial (is_footer_key, kms_instance_id, kms_instance_url, master_key_id,
0 commit comments