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
982
982
}
983
983
}
984
984
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
+
985
998
/// <summary>
986
999
/// AES Encryption strength for storage in extra data in entry header.
987
1000
/// 1 is 128 bit, 2 is 192 bit, 3 is 256 bit.
@@ -1360,7 +1373,7 @@ public static string CleanName(string name)
1360
1373
1361
1374
private bool forceZip64_ ;
1362
1375
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)
1364
1377
private int _aesEncryptionStrength ; // Encryption strength 1 = 128 2 = 192 3 = 256
1365
1378
1366
1379
#endregion Instance Fields
Original file line number Diff line number Diff line change @@ -375,6 +375,12 @@ protected override void StopDecrypting()
375
375
/// <param name="testCrc">True if the crc value should be tested</param>
376
376
private void CompleteCloseEntry ( bool testCrc )
377
377
{
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
+
378
384
StopDecrypting ( ) ;
379
385
380
386
if ( ( flags & 8 ) != 0 )
You can’t perform that action at this time.
0 commit comments