@@ -145,9 +145,7 @@ private void doEncryptDecryptWithParsedCiphertext(final int byteSize, final int
145
145
@ Test
146
146
public void encryptDecrypt () {
147
147
for (final CryptoAlgorithm cryptoAlg : EnumSet .allOf (CryptoAlgorithm .class )) {
148
- final int blockSize = cryptoAlg .getBlockSize ();
149
- final int [] frameSizeToTest = { 0 , blockSize , blockSize * 2 , blockSize * 10 ,
150
- AwsCrypto .getDefaultFrameSize () };
148
+ final int [] frameSizeToTest = TestUtils .getFrameSizesToTest (cryptoAlg );
151
149
152
150
for (int i = 0 ; i < frameSizeToTest .length ; i ++) {
153
151
final int frameSize = frameSizeToTest [i ];
@@ -175,9 +173,7 @@ public void encryptDecryptWithBadSignature() {
175
173
if (cryptoAlg .getTrailingSignatureAlgo () == null ) {
176
174
continue ;
177
175
}
178
- final int blockSize = cryptoAlg .getBlockSize ();
179
- final int [] frameSizeToTest = { 0 , blockSize , blockSize * 2 , blockSize * 10 ,
180
- AwsCrypto .getDefaultFrameSize () };
176
+ final int [] frameSizeToTest = TestUtils .getFrameSizesToTest (cryptoAlg );
181
177
182
178
for (int i = 0 ; i < frameSizeToTest .length ; i ++) {
183
179
final int frameSize = frameSizeToTest [i ];
@@ -202,9 +198,7 @@ public void encryptDecryptWithBadSignature() {
202
198
@ Test
203
199
public void encryptDecryptWithParsedCiphertext () {
204
200
for (final CryptoAlgorithm cryptoAlg : EnumSet .allOf (CryptoAlgorithm .class )) {
205
- final int blockSize = cryptoAlg .getBlockSize ();
206
- final int [] frameSizeToTest = { 0 , blockSize , blockSize * 2 , blockSize * 10 ,
207
- AwsCrypto .getDefaultFrameSize () };
201
+ final int [] frameSizeToTest = TestUtils .getFrameSizesToTest (cryptoAlg );
208
202
209
203
for (int i = 0 ; i < frameSizeToTest .length ; i ++) {
210
204
final int frameSize = frameSizeToTest [i ];
@@ -336,9 +330,7 @@ private void doEstimateCiphertextSize(final CryptoAlgorithm cryptoAlg, final int
336
330
@ Test
337
331
public void estimateCiphertextSize () {
338
332
for (final CryptoAlgorithm cryptoAlg : EnumSet .allOf (CryptoAlgorithm .class )) {
339
- final int blockSize = cryptoAlg .getBlockSize ();
340
- final int [] frameSizeToTest = { 0 , blockSize , blockSize * 2 , blockSize * 10 ,
341
- AwsCrypto .getDefaultFrameSize () };
333
+ final int [] frameSizeToTest = TestUtils .getFrameSizesToTest (cryptoAlg );
342
334
343
335
for (int i = 0 ; i < frameSizeToTest .length ; i ++) {
344
336
final int frameSize = frameSizeToTest [i ];
@@ -664,10 +656,12 @@ public void setValidFrameSize() throws IOException {
664
656
assertEquals (setFrameSize , getFrameSize );
665
657
}
666
658
667
- @ Test ( expected = IllegalArgumentException . class )
668
- public void unalignedFrameSizesAreRejected () throws IOException {
659
+
660
+ public void unalignedFrameSizesAreAccepted () throws IOException {
669
661
final int frameSize = AwsCrypto .getDefaultCryptoAlgorithm ().getBlockSize () - 1 ;
670
662
encryptionClient_ .setEncryptionFrameSize (frameSize );
663
+
664
+ assertEquals (frameSize , encryptionClient_ .getEncryptionFrameSize ());
671
665
}
672
666
673
667
@ Test (expected = IllegalArgumentException .class )
0 commit comments