File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed
src/main/java/software/amazon/encryption/s3/materials Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -183,6 +183,7 @@ public MaterialsDescription getMaterialsDescription() {
183183
184184 public static class Builder extends S3Keyring .Builder <AesKeyring , Builder > {
185185 private SecretKey _wrappingKey ;
186+ private boolean _reEncryptInstructionFile = false ;
186187
187188 private Builder () {
188189 super ();
@@ -203,8 +204,16 @@ public Builder wrappingKey(final SecretKey wrappingKey) {
203204 _wrappingKey = wrappingKey ;
204205 return builder ();
205206 }
207+ public Builder reEncryptInstructionFile (boolean reEncryptInstructionFile ) {
208+ _reEncryptInstructionFile = reEncryptInstructionFile ;
209+ return builder ();
210+
211+ }
206212
207213 public AesKeyring build () {
214+ if (_reEncryptInstructionFile && _materialsDescription == null ) {
215+ throw new S3EncryptionClientException ("Materials description must be provided for re-encrypt instruction file!" );
216+ }
208217 return new AesKeyring (this );
209218 }
210219 }
Original file line number Diff line number Diff line change @@ -203,6 +203,7 @@ public MaterialsDescription getMaterialsDescription() {
203203
204204 public static class Builder extends S3Keyring .Builder <S3Keyring , Builder > {
205205 private PartialRsaKeyPair _partialRsaKeyPair ;
206+ private boolean _reEncryptInstructionFile = false ;
206207
207208 private Builder () {
208209 super ();
@@ -217,10 +218,18 @@ public Builder wrappingKeyPair(final PartialRsaKeyPair partialRsaKeyPair) {
217218 _partialRsaKeyPair = partialRsaKeyPair ;
218219 return builder ();
219220 }
221+ public Builder reEncryptInstructionFile (final boolean reEncryptInstructionFile ) {
222+ _reEncryptInstructionFile = reEncryptInstructionFile ;
223+ return builder ();
224+ }
220225
221226 public RsaKeyring build () {
227+ if (_reEncryptInstructionFile && _materialsDescription == null ) {
228+ throw new S3EncryptionClientException ("Materials description must be provided for re-encrypt instruction file!" );
229+ }
222230 return new RsaKeyring (this );
223231 }
224- }
232+
233+ }
225234
226235}
You can’t perform that action at this time.
0 commit comments