-
Notifications
You must be signed in to change notification settings - Fork 122
/
Copy pathDecryptionMaterials.java
87 lines (69 loc) · 2.17 KB
/
DecryptionMaterials.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
package com.amazonaws.encryptionsdk.model;
import com.amazonaws.encryptionsdk.DataKey;
import java.security.PublicKey;
import java.util.Collections;
import java.util.Map;
public final class DecryptionMaterials {
private final DataKey<?> dataKey;
private final PublicKey trailingSignatureKey;
private final Map<String, String> encryptionContext;
private DecryptionMaterials(Builder b) {
dataKey = b.getDataKey();
trailingSignatureKey = b.getTrailingSignatureKey();
if (b.getEncryptionContext() != null) {
encryptionContext = b.getEncryptionContext();
} else {
encryptionContext = Collections.emptyMap();
}
}
public DataKey<?> getDataKey() {
return dataKey;
}
public PublicKey getTrailingSignatureKey() {
return trailingSignatureKey;
}
public Map<String, String> getEncryptionContext() {
return encryptionContext;
}
public static Builder newBuilder() {
return new Builder();
}
public Builder toBuilder() {
return new Builder(this);
}
public static final class Builder {
private DataKey<?> dataKey;
private PublicKey trailingSignatureKey;
private Map<String, String> encryptionContext;
private Builder(DecryptionMaterials result) {
this.dataKey = result.getDataKey();
this.trailingSignatureKey = result.getTrailingSignatureKey();
this.encryptionContext = result.getEncryptionContext();
}
private Builder() {}
public DataKey<?> getDataKey() {
return dataKey;
}
public Builder setDataKey(DataKey<?> dataKey) {
this.dataKey = dataKey;
return this;
}
public PublicKey getTrailingSignatureKey() {
return trailingSignatureKey;
}
public Builder setTrailingSignatureKey(PublicKey trailingSignatureKey) {
this.trailingSignatureKey = trailingSignatureKey;
return this;
}
public Map<String, String> getEncryptionContext() {
return encryptionContext;
}
public Builder setEncryptionContext(Map<String, String> encryptionContext) {
this.encryptionContext = encryptionContext;
return this;
}
public DecryptionMaterials build() {
return new DecryptionMaterials(this);
}
}
}