Skip to content

Commit e652052

Browse files
author
Anirav Kareddy
committed
added fix to retrieve the actual contents from the materials description object, not the object itself. Also reworded one of the exception messages to be clearer for when instruction file suffix request is specified for AES keyring (which should not happen)
1 parent 0e2b8ce commit e652052

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,9 @@ public ReEncryptInstructionFileResponse reEncryptInstructionFile(ReEncryptInstru
253253
RawKeyring newKeyring = reEncryptInstructionFileRequest.newKeyring();
254254
EncryptionMaterials encryptedMaterials = newKeyring.onEncrypt(encryptionMaterials);
255255

256-
if (encryptedMaterials.materialsDescription().equals(currentKeyringMaterialsDescription)) {
256+
Map<String, String> newMaterialsDescription = encryptedMaterials.materialsDescription().getMaterialsDescription();
257+
258+
if (newMaterialsDescription.equals(currentKeyringMaterialsDescription)) {
257259
throw new S3EncryptionClientException("New keyring must have new materials description!");
258260
}
259261

src/main/java/software/amazon/encryption/s3/internal/ReEncryptInstructionFileRequest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ public ReEncryptInstructionFileRequest build() {
139139
}
140140
if (newKeyring instanceof AesKeyring) {
141141
if (!instructionFileSuffix.equals(DEFAULT_INSTRUCTION_FILE_SUFFIX)) {
142-
throw new S3EncryptionClientException("Instruction file suffix is not applicable for AES keyring!");
142+
throw new S3EncryptionClientException("Custom Instruction file suffix is not applicable for AES keyring!");
143143
}
144144
} else if (newKeyring instanceof RsaKeyring) {
145145
if (instructionFileSuffix.equals(DEFAULT_INSTRUCTION_FILE_SUFFIX)) {

0 commit comments

Comments
 (0)