@@ -640,49 +640,10 @@ public void setValidFrameSize() throws IOException {
640640 assertEquals (setFrameSize , getFrameSize );
641641 }
642642
643- @ Test
644- public void unalignedFrameSizesAreAccepted () throws IOException {
643+ @ Test ( expected = IllegalArgumentException . class )
644+ public void unalignedFrameSizesAreRejected () throws IOException {
645645 final int frameSize = AwsCrypto .getDefaultCryptoAlgorithm ().getBlockSize () - 1 ;
646646 encryptionClient_ .setEncryptionFrameSize (frameSize );
647-
648- // Make sure we can encrypt with unaligned small frame sizes.
649- encryptionClient_ .decryptData (masterKeyProvider ,
650- encryptionClient_ .encryptData (masterKeyProvider , new byte [1 ]).getResult ());
651-
652- encryptionClient_ .setEncryptionFrameSize (frameSize + 2 );
653- encryptionClient_ .decryptData (masterKeyProvider ,
654- encryptionClient_ .encryptData (masterKeyProvider , new byte [1 ]).getResult ());
655-
656- // Make sure really large frame sizes work too.
657- // Note that going all the way up to Integer.MAX_VALUE hits JVM limits.
658- encryptionClient_ .setEncryptionFrameSize (Integer .MAX_VALUE - 16 );
659- OutputStream nullOutputStream = new OutputStream () {
660- @ Override public void write (final int b ) throws IOException {
661-
662- }
663-
664- @ Override public void write (final byte [] b ) throws IOException {
665-
666- }
667-
668- @ Override public void write (final byte [] b , final int off , final int len ) throws IOException {
669-
670- }
671- };
672-
673- OutputStream decrypter = encryptionClient_ .createDecryptingStream (masterKeyProvider , nullOutputStream );
674- OutputStream encrypter = encryptionClient_ .createEncryptingStream (masterKeyProvider , nullOutputStream );
675-
676- byte [] buf = new byte [1024 *1024 ];
677- long bytesRemaining = Integer .MAX_VALUE + 1 ;
678-
679- while (bytesRemaining > 0 ) {
680- int toWrite = Math .toIntExact (Math .min (buf .length , bytesRemaining ));
681-
682- encrypter .write (buf , 0 , toWrite );
683- }
684-
685- encrypter .close ();
686647 }
687648
688649 @ Test (expected = IllegalArgumentException .class )
0 commit comments