File tree Expand file tree Collapse file tree 2 files changed +7
-7
lines changed
src/ICSharpCode.SharpZipLib/Zip
test/ICSharpCode.SharpZipLib.Tests/Zip Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -1289,15 +1289,15 @@ private long TestLocalHeader(ZipEntry entry, HeaderTest tests)
12891289 // If so until details are known we will be strict.
12901290 if ( entry . IsCrypted )
12911291 {
1292- if ( compressedSize > ZipConstants . CryptoHeaderSize + 2 )
1292+ if ( compressedSize > entry . EncryptionOverheadSize + 2 )
12931293 {
12941294 throw new ZipException ( "Directory compressed size invalid" ) ;
12951295 }
12961296 }
12971297 else if ( compressedSize > 2 )
12981298 {
12991299 // When not compressed the directory size can validly be 2 bytes
1300- // if the true size wasnt known when data was originally being written.
1300+ // if the true size wasn't known when data was originally being written.
13011301 // NOTE: Versions of the library 0.85.4 and earlier always added 2 bytes
13021302 throw new ZipException ( "Directory compressed size invalid" ) ;
13031303 }
Original file line number Diff line number Diff line change @@ -875,13 +875,13 @@ public void TestDirectoryEntry()
875875 TestDirectoryEntry ( new MemoryStreamWithoutSeek ( ) ) ;
876876 }
877877
878- private void TestEncryptedDirectoryEntry ( MemoryStream s )
878+ private void TestEncryptedDirectoryEntry ( MemoryStream s , int aesKeySize )
879879 {
880880 var outStream = new ZipOutputStream ( s ) ;
881881 outStream . Password = "Tonto hand me a beer" ;
882882
883883 outStream . IsStreamOwner = false ;
884- outStream . PutNextEntry ( new ZipEntry ( "YeUnreadableDirectory/" ) ) ;
884+ outStream . PutNextEntry ( new ZipEntry ( "YeUnreadableDirectory/" ) { AESKeySize = aesKeySize } ) ;
885885 outStream . Close ( ) ;
886886
887887 var ms2 = new MemoryStream ( s . ToArray ( ) ) ;
@@ -893,10 +893,10 @@ private void TestEncryptedDirectoryEntry(MemoryStream s)
893893
894894 [ Test ]
895895 [ Category ( "Zip" ) ]
896- public void TestEncryptedDirectoryEntry ( )
896+ public void TestEncryptedDirectoryEntry ( [ Values ( 0 , 128 , 256 ) ] int aesKeySize )
897897 {
898- TestEncryptedDirectoryEntry ( new MemoryStream ( ) ) ;
899- TestEncryptedDirectoryEntry ( new MemoryStreamWithoutSeek ( ) ) ;
898+ TestEncryptedDirectoryEntry ( new MemoryStream ( ) , aesKeySize ) ;
899+ TestEncryptedDirectoryEntry ( new MemoryStreamWithoutSeek ( ) , aesKeySize ) ;
900900 }
901901
902902 [ Test ]
You can’t perform that action at this time.
0 commit comments