You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
2
+
// SPDX-License-Identifier: Apache-2.0
3
+
packagesoftware.amazon.encryption.s3;
4
+
5
+
/**
6
+
* Defines the S3 Encryption Client's key commitment behavior during encryption and decryption operations.
7
+
* Key commitment ensures each encrypted object can be decrypted to only a single plaintext by cryptographically binding the data key to the encrypted object.
8
+
* <p>
9
+
* For more information, refer to the <a href=https://docs.aws.amazon.com/amazon-s3-encryption-client/latest/developerguide/concepts.html)>Developer Guide.</a>
//# When the commitment policy is FORBID_ENCRYPT_ALLOW_DECRYPT, the S3EC MUST allow decryption using algorithm suites which do not support key commitment.
15
+
/**
16
+
* This policy forbids the client from encrypting objects with an algorithm suite which supports key commitment.
17
+
* This policy allows decryption of objects using algorithm suites which do not support key commitment. Objects encrypted with key commitment may be decrypted as well.
18
+
* <p>
19
+
* This client will write objects that any v3 client can read and any v4 client can read.
20
+
* This client can read objects written by any v3 or v4 client.
21
+
* This is the default (and only) policy for v3 clients.
//# When the commitment policy is REQUIRE_ENCRYPT_ALLOW_DECRYPT, the S3EC MUST allow decryption using algorithm suites which do not support key commitment.
29
+
/**
30
+
* This policy requires the client to encrypt objects using an algorithm suite which supports key commitment.
31
+
* This policy allows decryption of objects using algorithm suites which do not support key commitment. Objects encrypted with key commitment may be decrypted as well.
32
+
* <p>
33
+
* This client will write objects that any v4 client can read.
34
+
* Only V4 clients and the latest V3 client can read objects written by a client using this policy.
35
+
* This client can read objects written by any V3 or V4 client.
//# When the commitment policy is REQUIRE_ENCRYPT_REQUIRE_DECRYPT, the S3EC MUST NOT allow decryption using algorithm suites which do not support key commitment.
43
+
/**
44
+
* This policy requires the client to encrypt objects using an algorithm suite which supports key commitment.
45
+
* This policy requires that objects have been encrypted using an algorithm suite which supports key commitment.
46
+
* <p>
47
+
* This client will write objects that any v4 client can read.
48
+
* Only V4 clients and the latest V3 clients can read objects written by a client using this policy.
49
+
* This client can only read objects written by v4 clients with key commitment enabled.
50
+
* This is the most secure policy and should be used when all objects are encrypted with key commitment.
//# The S3EC MUST support configuration of the [Key Commitment policy](./key-commitment.md) during its initialization.
616
+
/**
617
+
* Sets the commitment policy for this S3 encryption client.
618
+
* The commitment policy determines whether the client requires, forbids, or allows
619
+
* key commitment during encryption and decryption operations.
620
+
* <p>
621
+
* Defaults to REQUIRE_ENCRYPT_REQUIRE_DECRYPT which provides the highest security.
622
+
* This policy will reject messages encrypted without key commitment, so it should be only used when all the objects expected to succeed decryption have been encrypted using key commitment.
623
+
*
624
+
* @param commitmentPolicy the commitment policy to use
625
+
* @return this builder instance for method chaining
//# If the configured Encryption Algorithm is incompatible with the key commitment policy, then it MUST throw an exception.
979
+
thrownewS3EncryptionClientException(
980
+
"This client can ONLY be built with these Settings: Commitment Policy: FORBID_ENCRYPT_ALLOW_DECRYPT; Encryption Algorithm: ALG_AES_256_GCM_IV12_TAG16_NO_KDF. "
981
+
+ "Note that the Encryption Algorithm does NOT effect Decryption; See: https://docs.aws.amazon.com/amazon-s3-encryption-client/latest/developerguide/encryption-algorithms.html#decryption-modes. "
982
+
+ "Please update your configuration. Provided algorithm: " + _encryptionAlgorithm.name() + " and commitment policy: " + _commitmentPolicy.name()
0 commit comments