Skip to content

Commit edc1cac

Browse files
author
Anirav Kareddy
committed
removed materials description from this class and renamed _encryptionDataKeyContext to _encryptionContextOrMatDesc bc in V2 both encryption context and materials description were treated the same (backwards compatability)
1 parent 81215b1 commit edc1cac

File tree

1 file changed

+5
-15
lines changed

1 file changed

+5
-15
lines changed

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

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,26 +16,24 @@ public class ContentMetadata {
1616

1717
private final EncryptedDataKey _encryptedDataKey;
1818
private final String _encryptedDataKeyAlgorithm;
19-
private final Map<String, String> _encryptedDataKeyContext;
19+
private final Map<String, String> _encryptionContextOrMatDesc;
2020

2121
private final byte[] _contentIv;
2222
private final String _contentCipher;
2323
private final String _contentCipherTagLength;
2424
private final String _contentRange;
25-
private final MaterialsDescription _materialsDescription;
2625

2726
private ContentMetadata(Builder builder) {
2827
_algorithmSuite = builder._algorithmSuite;
2928

3029
_encryptedDataKey = builder._encryptedDataKey;
3130
_encryptedDataKeyAlgorithm = builder._encryptedDataKeyAlgorithm;
32-
_encryptedDataKeyContext = builder._encryptedDataKeyContext;
31+
_encryptionContextOrMatDesc = builder._encryptionContextOrMatDesc;
3332

3433
_contentIv = builder._contentIv;
3534
_contentCipher = builder._contentCipher;
3635
_contentCipherTagLength = builder._contentCipherTagLength;
3736
_contentRange = builder._contentRange;
38-
_materialsDescription = builder._materialsDescription;
3937
}
4038

4139
public static Builder builder() {
@@ -54,9 +52,6 @@ public String encryptedDataKeyAlgorithm() {
5452
return _encryptedDataKeyAlgorithm;
5553
}
5654

57-
public MaterialsDescription materialsDescription() {
58-
return _materialsDescription;
59-
}
6055

6156
/**
6257
* Note that the underlying implementation uses a Collections.unmodifiableMap which is
@@ -65,7 +60,7 @@ public MaterialsDescription materialsDescription() {
6560
@SuppressFBWarnings(value = "EI_EXPOSE_REP", justification = "False positive; underlying"
6661
+ " implementation is immutable")
6762
public Map<String, String> encryptedDataKeyContext() {
68-
return _encryptedDataKeyContext;
63+
return _encryptionContextOrMatDesc;
6964
}
7065

7166
public byte[] contentIv() {
@@ -92,13 +87,12 @@ public static class Builder {
9287

9388
private EncryptedDataKey _encryptedDataKey;
9489
private String _encryptedDataKeyAlgorithm;
95-
private Map<String, String> _encryptedDataKeyContext;
90+
private Map<String, String> _encryptionContextOrMatDesc;
9691

9792
private byte[] _contentIv;
9893
private String _contentCipher;
9994
private String _contentCipherTagLength;
10095
public String _contentRange;
101-
private MaterialsDescription _materialsDescription;
10296

10397
private Builder() {
10498

@@ -120,7 +114,7 @@ public Builder encryptedDataKeyAlgorithm(String encryptedDataKeyAlgorithm) {
120114
}
121115

122116
public Builder encryptedDataKeyContext(Map<String, String> encryptedDataKeyContext) {
123-
_encryptedDataKeyContext = Collections.unmodifiableMap(encryptedDataKeyContext);
117+
_encryptionContextOrMatDesc = Collections.unmodifiableMap(encryptedDataKeyContext);
124118
return this;
125119
}
126120

@@ -133,10 +127,6 @@ public Builder contentRange(String contentRange) {
133127
_contentRange = contentRange;
134128
return this;
135129
}
136-
public Builder materialsDescription(MaterialsDescription materialsDescription) {
137-
_materialsDescription = materialsDescription;
138-
return this;
139-
}
140130

141131
public ContentMetadata build() {
142132
return new ContentMetadata(this);

0 commit comments

Comments
 (0)