@@ -136,8 +136,8 @@ private ContentMetadata readFromMap(Map<String, String> metadata, GetObjectRespo
136136 .keyProviderInfo (keyProviderInfo .getBytes (StandardCharsets .UTF_8 ))
137137 .build ();
138138
139- // Get encrypted data key encryption context
140- final Map <String , String > encryptionContext = new HashMap <>();
139+ // Get encrypted data key encryption context or materials description (depending on the keyring)
140+ final Map <String , String > encryptionContextOrMatDesc = new HashMap <>();
141141 // The V2 client treats null value here as empty, do the same to avoid incompatibility
142142 String jsonEncryptionContext = metadata .getOrDefault (MetadataKeyConstants .ENCRYPTED_DATA_KEY_CONTEXT , "{}" );
143143 // When the encryption context contains non-US-ASCII characters,
@@ -149,7 +149,7 @@ private ContentMetadata readFromMap(Map<String, String> metadata, GetObjectRespo
149149 JsonNode objectNode = parser .parse (decodedJsonEncryptionContext );
150150
151151 for (Map .Entry <String , JsonNode > entry : objectNode .asObject ().entrySet ()) {
152- encryptionContext .put (entry .getKey (), entry .getValue ().asString ());
152+ encryptionContextOrMatDesc .put (entry .getKey (), entry .getValue ().asString ());
153153 }
154154 } catch (Exception e ) {
155155 throw new RuntimeException (e );
@@ -161,7 +161,7 @@ private ContentMetadata readFromMap(Map<String, String> metadata, GetObjectRespo
161161 return ContentMetadata .builder ()
162162 .algorithmSuite (algorithmSuite )
163163 .encryptedDataKey (edk )
164- .encryptedDataKeyContext ( encryptionContext )
164+ .encryptionContextOrMatDesc ( encryptionContextOrMatDesc )
165165 .contentIv (iv )
166166 .contentRange (contentRange )
167167 .build ();
0 commit comments