Skip to content

Commit 3ee7571

Browse files
author
Anirav Kareddy
committed
rennamed variables + moving things around
1 parent edc1cac commit 3ee7571

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/main/java/software/amazon/encryption/s3/internal/ContentMetadata.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ public Builder encryptedDataKeyAlgorithm(String encryptedDataKeyAlgorithm) {
113113
return this;
114114
}
115115

116-
public Builder encryptedDataKeyContext(Map<String, String> encryptedDataKeyContext) {
117-
_encryptionContextOrMatDesc = Collections.unmodifiableMap(encryptedDataKeyContext);
116+
public Builder encryptionContextOrMatDesc(Map<String, String> encryptionContextOrMatDesc) {
117+
_encryptionContextOrMatDesc = Collections.unmodifiableMap(encryptionContextOrMatDesc);
118118
return this;
119119
}
120120

src/main/java/software/amazon/encryption/s3/internal/ContentMetadataDecodingStrategy.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)