Example #1
0
 private void ProcessAESExtraData(ZipExtraData extraData)
 {
     if (!extraData.Find(0x9901))
     {
         throw new ZipException("AES Extra Data missing");
     }
     versionToExtract = 0x33;
     Flags |= 0x40;
     int valueLength = extraData.ValueLength;
     if (valueLength < 7)
     {
         throw new ZipException("AES Extra Data Length " + valueLength + " invalid.");
     }
     extraData.ReadShort();
     extraData.ReadShort();
     int num3 = extraData.ReadByte();
     int num4 = extraData.ReadShort();
     _aesEncryptionStrength = num3;
     method = (CompressionMethod)num4;
 }
Example #2
0
 internal void ProcessExtraData(bool localHeader)
 {
     ZipExtraData extraData = new ZipExtraData(extra);
     if (extraData.Find(1))
     {
         forceZip64_ = true;
         if (extraData.ValueLength < 4)
         {
             throw new ZipException("Extra data extended Zip64 information length is invalid");
         }
         if (localHeader || (size == 0xffffffffL))
         {
             size = (ulong)extraData.ReadLong();
         }
         if (localHeader || (compressedSize == 0xffffffffL))
         {
             compressedSize = (ulong)extraData.ReadLong();
         }
         if (!localHeader && (offset == 0xffffffffL))
         {
             offset = extraData.ReadLong();
         }
     }
     else if (((versionToExtract & 0xff) >= 0x2d) && ((size == 0xffffffffL) || (compressedSize == 0xffffffffL)))
     {
         throw new ZipException("Zip64 Extended information required but is missing.");
     }
     if (extraData.Find(10))
     {
         if (extraData.ValueLength < 4)
         {
             throw new ZipException("NTFS Extra data invalid");
         }
         extraData.ReadInt();
         while (extraData.UnreadCount >= 4)
         {
             int num = extraData.ReadShort();
             int amount = extraData.ReadShort();
             if (num == 1)
             {
                 if (amount >= 0x18)
                 {
                     long fileTime = extraData.ReadLong();
                     extraData.ReadLong();
                     extraData.ReadLong();
                     DateTime = DateTime.FromFileTime(fileTime);
                 }
                 break;
             }
             extraData.Skip(amount);
         }
     }
     else if (extraData.Find(0x5455))
     {
         int valueLength = extraData.ValueLength;
         if (((extraData.ReadByte() & 1) != 0) && (valueLength >= 5))
         {
             int seconds = extraData.ReadInt();
             DateTime time = new DateTime(0x7b2, 1, 1, 0, 0, 0);
             DateTime = (time.ToUniversalTime() + new TimeSpan(0, 0, 0, seconds, 0)).ToLocalTime();
         }
     }
     if (method == CompressionMethod.WinZipAES)
     {
         ProcessAESExtraData(extraData);
     }
 }