3
3
4
4
package com .amazonaws .encryptionsdk ;
5
5
6
+ /**
7
+ * Governs how a AwsCrypto behaves during configuration, encryption, and decryption, with respect to
8
+ * key commitment.
9
+ */
6
10
public enum CommitmentPolicy {
11
+ /**
12
+ * On encrypty, algorithm suite must NOT support key commitment; On decrypt, if a key commitment
13
+ * is present on the ciphertext, then the key commitment must be valid. Key commitment will NOT be
14
+ * included in ciphertext on encrypt.
15
+ */
7
16
ForbidEncryptAllowDecrypt ,
17
+ /**
18
+ * On encrypt, algorithm suite must support key commitment; On decrypt, if a key commitment is
19
+ * present on the ciphertext, then the key commitment must be valid. Key commitment will be
20
+ * included in ciphertext on encrypt.
21
+ */
8
22
RequireEncryptAllowDecrypt ,
23
+ /**
24
+ * Algorithm suite must support key commitment. Key commitment will be included in ciphertext on
25
+ * encrypt. Valid key commitment must be present in ciphertext on decrypt.
26
+ */
9
27
RequireEncryptRequireDecrypt ;
10
28
29
+ /** Validates that an algorithm meets the Policy's On encrypt key commitment. */
11
30
public boolean algorithmAllowedForEncrypt (CryptoAlgorithm algorithm ) {
12
31
switch (this ) {
13
32
case ForbidEncryptAllowDecrypt :
@@ -21,6 +40,7 @@ public boolean algorithmAllowedForEncrypt(CryptoAlgorithm algorithm) {
21
40
}
22
41
}
23
42
43
+ /** Validates that an algorithm meets the Policy's On decrypt key commitment. */
24
44
public boolean algorithmAllowedForDecrypt (CryptoAlgorithm algorithm ) {
25
45
switch (this ) {
26
46
case ForbidEncryptAllowDecrypt :
0 commit comments