Skip to content

Commit 66126e0

Browse files
author
Anirav Kareddy
committed
cleaned up the reEncryptInstructionFile method + added description for enforceRotation in javadoc
1 parent b4c1d57 commit 66126e0

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/main/java/software/amazon/encryption/s3/S3EncryptionClient.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ public static Consumer<AwsRequestOverrideConfiguration.Builder> withAdditionalCo
207207
* Key rotation scenarios:
208208
* - Legacy to V3: Can rotate same wrapping key from legacy wrapping algorithms to fully supported wrapping algorithms
209209
* - Within V3: When rotating the wrapping key, the new keyring must be different from the current keyring
210+
* - Enforce Rotation: When enabled, ensures old keyring cannot decrypt data encrypted by new keyring
210211
*
211212
* @param reEncryptInstructionFileRequest the request containing bucket, object key, new keyring, and optional instruction file suffix
212213
* @return ReEncryptInstructionFileResponse containing the bucket, object key, and instruction file suffix used
@@ -239,6 +240,7 @@ public ReEncryptInstructionFileResponse reEncryptInstructionFile(ReEncryptInstru
239240
.s3Request(request)
240241
.build()
241242
);
243+
242244
//Plaintext Data Key MUST be kept the same
243245
final byte[] plaintextDataKey = decryptedMaterials.plaintextDataKey();
244246

@@ -248,7 +250,8 @@ public ReEncryptInstructionFileResponse reEncryptInstructionFile(ReEncryptInstru
248250
.s3Request(request)
249251
.build();
250252

251-
RawKeyring newKeyring = reEncryptInstructionFileRequest.newKeyring();
253+
//New Keyring MUST be kept the same
254+
final RawKeyring newKeyring = reEncryptInstructionFileRequest.newKeyring();
252255
//Encrypted Materials MUST be kept the same
253256
final EncryptionMaterials encryptedMaterials = newKeyring.onEncrypt(encryptionMaterials);
254257
//New Keyring's Materials Description MUST be kept the same

0 commit comments

Comments
 (0)