Skip to content

Commit 8b16a23

Browse files
author
Anirav Kareddy
committed
changed S3Keyring to RawKeyring and also added getter functions
1 parent 8ac06bb commit 8b16a23

File tree

1 file changed

+22
-7
lines changed

1 file changed

+22
-7
lines changed

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

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,16 @@
22

33
import software.amazon.encryption.s3.S3EncryptionClientException;
44
import software.amazon.encryption.s3.materials.AesKeyring;
5-
import software.amazon.encryption.s3.materials.KmsKeyring;
5+
import software.amazon.encryption.s3.materials.RawKeyring;
66
import software.amazon.encryption.s3.materials.RsaKeyring;
7-
import software.amazon.encryption.s3.materials.S3Keyring;
87

98
/** Request object for re-encrypting instruction files.
109
* Supports both AES and RSA keyring with different instruction file suffixes.
1110
*/
1211
public class ReEncryptInstructionFileRequest {
1312
private final String bucket;
1413
private final String key;
15-
private final S3Keyring newKeyring;
14+
private final RawKeyring newKeyring;
1615
private final String instructionFileSuffix;
1716

1817
private ReEncryptInstructionFileRequest(Builder builder) {
@@ -21,14 +20,32 @@ private ReEncryptInstructionFileRequest(Builder builder) {
2120
newKeyring = builder.newKeyring;
2221
instructionFileSuffix = builder.instructionFileSuffix;
2322
}
23+
24+
public String bucket() {
25+
return bucket;
26+
}
27+
28+
public String key() {
29+
return key;
30+
}
31+
32+
public RawKeyring newKeyring() {
33+
return newKeyring;
34+
}
35+
36+
public String instructionFileSuffix() {
37+
return instructionFileSuffix;
38+
}
39+
2440
public static Builder builder() {
2541
return new Builder();
2642
}
43+
2744
public static class Builder {
2845
private static final String DEFAULT_INSTRUCTION_FILE_SUFFIX = ".instruction";
2946
private String bucket;
3047
private String key;
31-
private S3Keyring newKeyring;
48+
private RawKeyring newKeyring;
3249
private String instructionFileSuffix = DEFAULT_INSTRUCTION_FILE_SUFFIX;
3350

3451
public Builder bucket(String bucket) {
@@ -41,7 +58,7 @@ public Builder key(String key) {
4158
return this;
4259
}
4360

44-
public Builder newKeyring(S3Keyring newKeyring) {
61+
public Builder newKeyring(RawKeyring newKeyring) {
4562
this.newKeyring = newKeyring;
4663
return this;
4764
}
@@ -69,8 +86,6 @@ public ReEncryptInstructionFileRequest build() {
6986
if (instructionFileSuffix.equals(DEFAULT_INSTRUCTION_FILE_SUFFIX)) {
7087
throw new S3EncryptionClientException("Instruction file suffix must be different than the default one for RSA keyring!");
7188
}
72-
} else if (newKeyring instanceof KmsKeyring){
73-
throw new S3EncryptionClientException("KMS keyring is not supported for re-encrypting instruction file!");
7489
}
7590
return new ReEncryptInstructionFileRequest(this);
7691
}

0 commit comments

Comments
 (0)