Skip to content

Commit 767c58b

Browse files
author
Anirav Kareddy
committed
Made sure to modify the javadoc comments to mention that RSA keyrings support both the default and custom instruction file suffixes
1 parent 4e70b6a commit 767c58b

File tree

1 file changed

+5
-11
lines changed

1 file changed

+5
-11
lines changed

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

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
import software.amazon.encryption.s3.S3EncryptionClientException;
66
import software.amazon.encryption.s3.materials.AesKeyring;
77
import software.amazon.encryption.s3.materials.RawKeyring;
8-
import software.amazon.encryption.s3.materials.RsaKeyring;
8+
9+
import static software.amazon.encryption.s3.S3EncryptionClientUtilities.DEFAULT_INSTRUCTION_FILE_SUFFIX;
910

1011
/**
1112
* Request object for re-encrypting instruction files in S3.
1213
* This request supports re-encryption operations using either AES or RSA keyrings.
1314
* For AES keyrings, only the default instruction file suffix is supported.
14-
* For RSA keyrings, a custom instruction file suffix must be provided to support
15-
* multiple accesses to the same encrypted object.
15+
* For RSA keyrings, both the default and custom instruction file suffixes are supported.
1616
*/
1717
public class ReEncryptInstructionFileRequest {
1818
private final String bucket;
@@ -49,8 +49,7 @@ public RawKeyring newKeyring() {
4949
}
5050

5151
/**
52-
* @return the suffix to use for the instruction file. The default instruction file suffix is ".instruction" for
53-
* AES keyrings and the instruction file suffix must be different from the default one for RSA keyrings
52+
* @return the suffix to use for the instruction file. The default instruction file suffix is ".instruction"
5453
*/
5554
public String instructionFileSuffix() {
5655
return instructionFileSuffix;
@@ -69,7 +68,6 @@ public static Builder builder() {
6968
* Builder for ReEncryptInstructionFileRequest.
7069
*/
7170
public static class Builder {
72-
private static final String DEFAULT_INSTRUCTION_FILE_SUFFIX = ".instruction";
7371
private String bucket;
7472
private String key;
7573
private RawKeyring newKeyring;
@@ -111,7 +109,7 @@ public Builder newKeyring(RawKeyring newKeyring) {
111109
/**
112110
* Sets a custom instruction file suffix for the re-encrypted instruction file.
113111
* For AES keyrings, only the default instruction file suffix is allowed.
114-
* For RSA keyrings, a custom suffix different from the default must be provided.
112+
* For RSA keyrings, both the default and custom instruction file suffixes are allowed.
115113
*
116114
* @param instructionFileSuffix the instruction file suffix
117115
* @return a reference to this object so that method calls can be chained together.
@@ -141,10 +139,6 @@ public ReEncryptInstructionFileRequest build() {
141139
if (!instructionFileSuffix.equals(DEFAULT_INSTRUCTION_FILE_SUFFIX)) {
142140
throw new S3EncryptionClientException("Custom Instruction file suffix is not applicable for AES keyring!");
143141
}
144-
} else if (newKeyring instanceof RsaKeyring) {
145-
if (instructionFileSuffix.equals(DEFAULT_INSTRUCTION_FILE_SUFFIX)) {
146-
throw new S3EncryptionClientException("Instruction file suffix must be different than the default one for RSA keyring!");
147-
}
148142
}
149143
return new ReEncryptInstructionFileRequest(this);
150144
}

0 commit comments

Comments
 (0)