33
44package com .amazonaws .encryptionsdk ;
55
6+ /**
7+ * Governs how a AwsCrypto behaves during configuration, encryption, and decryption, with respect to
8+ * key commitment.
9+ */
610public 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+ */
716 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+ */
822 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+ */
927 RequireEncryptRequireDecrypt ;
1028
29+ /** Validates that an algorithm meets the Policy's On encrypt key commitment. */
1130 public boolean algorithmAllowedForEncrypt (CryptoAlgorithm algorithm ) {
1231 switch (this ) {
1332 case ForbidEncryptAllowDecrypt :
@@ -21,6 +40,7 @@ public boolean algorithmAllowedForEncrypt(CryptoAlgorithm algorithm) {
2140 }
2241 }
2342
43+ /** Validates that an algorithm meets the Policy's On decrypt key commitment. */
2444 public boolean algorithmAllowedForDecrypt (CryptoAlgorithm algorithm ) {
2545 switch (this ) {
2646 case ForbidEncryptAllowDecrypt :
0 commit comments