File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed
src/ICSharpCode.SharpZipLib/Zip Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -982,6 +982,19 @@ public int AESKeySize
982982 }
983983 }
984984
985+ /// <summary>
986+ /// Gets the AES Version
987+ /// 1: AE-1
988+ /// 2: AE-2
989+ /// </summary>
990+ public int AESVersion
991+ {
992+ get
993+ {
994+ return _aesVer ;
995+ }
996+ }
997+
985998 /// <summary>
986999 /// AES Encryption strength for storage in extra data in entry header.
9871000 /// 1 is 128 bit, 2 is 192 bit, 3 is 256 bit.
@@ -1360,7 +1373,7 @@ public static string CleanName(string name)
13601373
13611374 private bool forceZip64_ ;
13621375 private byte cryptoCheckValue_ ;
1363- private int _aesVer ; // Version number (2 = AE-2 ?). Assigned but not used.
1376+ private int _aesVer ; // Version number (1 = AE-1, 2 = AE-2)
13641377 private int _aesEncryptionStrength ; // Encryption strength 1 = 128 2 = 192 3 = 256
13651378
13661379 #endregion Instance Fields
Original file line number Diff line number Diff line change @@ -375,6 +375,12 @@ protected override void StopDecrypting()
375375 /// <param name="testCrc">True if the crc value should be tested</param>
376376 private void CompleteCloseEntry ( bool testCrc )
377377 {
378+ // AE-2 does not have a CRC by specification. Do not check CRC in this case.
379+ if ( entry . AESKeySize != 0 && entry . AESVersion == 2 )
380+ {
381+ testCrc = false ;
382+ }
383+
378384 StopDecrypting ( ) ;
379385
380386 if ( ( flags & 8 ) != 0 )
You can’t perform that action at this time.
0 commit comments