[
  {
    "Id": "508889",
    "ThreadId": "231352",
    "Html": "<p>Hi Cheeso,</p>\r\n<p>Still loving this library, however I've just encountered the following error whilst using DotNetZip (1.9) to extract a zip file that has been encrypted using AES 256 (encrypted by DotNetZip):</p>\r\n<p>&quot;The final hash has not been computed&quot;</p>\r\n<p>After some investigation, I have isolated the file in question, and tried to unzip it with the DotNetZip unzip.exe tool - I get the following output:</p>\r\n<p>exception: Ionic.Zip.BadStateException: The final hash has not been computed.<br>&nbsp;&nbsp; at Ionic.Zip.WinZipAesCipherStream.get_FinalAuthentication()<br>&nbsp;&nbsp; at Ionic.Zip.ZipEntry.VerifyCrcAfterExtract(Int32 ActualCrc32)<br>&nbsp;&nbsp; at Ionic.Zip.ZipEntry.InternalExtract(String baseDir, Stream outstream, String password)<br>&nbsp;&nbsp; at Ionic.Zip.ZipEntry.ExtractWithPassword(String baseDirectory, ExtractExistingFileAction extractExistingFile, String password)<br>&nbsp;&nbsp; at Ionic.Zip.Examples.UnZip.Main(String[] args)</p>\r\n<p>The problem is reproducible with the same original file, and the resulting zip files do unzip successfully using 7-zip, so I don't think the file itself is corrupted - I have never seen this problem before, so I was wondering if it is some kind of rare block alignment issue causing the _NextXFormWillBeFinal or _finalBlock flag to not be set correctly in the WinZipAesCipherStream class?&nbsp; I've tried running the UnZip.exe project in my debugger to step through the decryption code, but am having some dev studio setup issues at the moment.&nbsp; The compressed file is 294943 bytes long, which doesn't strike me as a multiple of anything significant, but then I'm not sure what size the salt and checksums are etc...</p>\r\n<p>Obviously none of this is much use to you without the sample .zip file!</p>",
    "PostedDate": "2010-10-18T10:05:56.23-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "509001",
    "ThreadId": "231352",
    "Html": "<p>yes, exactly.&nbsp; If I had the same zip I'd be able to troubleshoot and diagnose much more easily.</p>\r\n<p>Any chance you can send it to me?</p>",
    "PostedDate": "2010-10-18T14:29:28.937-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "509242",
    "ThreadId": "231352",
    "Html": "Hi Cheeso,<br>Thanks for the response, I've attached the file in question!<br><br>As a bit more background:<br><br>The password is 'logan12'<br><br>If I try and extract using DotNetZip-WinFormsTool.exe I get an error <br>message box:<br>&quot;Failed to extract the password-encrypted entry PAT1/STD1/SER1/IMG203 -- <br>The final hash has not been computed&quot;<br><br>If I try using the unzip.exe I get the following:<br><br>G:\\DotNetZip\\tools 1.9&gt;unzip g:\\ziptest\\decryptFail.zip -p logan12 -d <br>g:\\ziptest\\img203<br><br>Zipfile: g:\\ziptest\\decryptFail.zip<br><br>Modified              Size  Ratio Packed  pw?      CRC Filename<br>---------------------------------------------------------------------<br><br>2010-10-18 15:43:38      0     0%      0    N 00000000 PAT1/<br>2010-10-18 15:43:38      0     0%      0    N 00000000 PAT1/STD1/<br>2010-10-18 15:44:14      0     0%      0    N 00000000 PAT1/STD1/SER1/<br>2010-10-18 15:43:48 528220    44% 294943    Y 7873BA97 PAT1/STD1/SE<br>R1/IMG203<br>exception: Ionic.Zip.BadStateException: The final hash has not been <br>computed.<br>    at Ionic.Zip.WinZipAesCipherStream.get_FinalAuthentication()<br>    at Ionic.Zip.ZipEntry.VerifyCrcAfterExtract(Int32 ActualCrc32)<br>    at Ionic.Zip.ZipEntry.InternalExtract(String baseDir, Stream <br>outstream, String password)<br>    at Ionic.Zip.ZipEntry.ExtractWithPassword(String baseDirectory, <br>ExtractExistingFileAction extractExistingFile, String password)<br>    at Ionic.Zip.Examples.UnZip.Main(String[] args)<br><br>However 7-Zip and WinRar can both extract the file IMG203 successfully, <br>so I think the file itself is ok.<br><br><br>The original file is an anonymised medical image which has been <br>encrypted with the following C++ pseudo code options:<br><br>ZipFile^ zipArchive = gcnew ZipFile;<br>zipArchive-&gt;Encryption = EncryptionAlgorithm::WinZipAes256;<br>zipArchive-&gt;Password = &quot;logan12&quot;;  // in this instance anyway!<br>zipArchive-&gt;UseZip64WhenSaving = Zip64Option::AsNecessary;<br>zipArchive-&gt;CompressionLevel = CompressionLevel::BestSpeed;<br>zipArchive-&gt;Strategy = CompressionStrategy::HuffmanOnly;<br>zipArchive-&gt;AddDirectory(srcDirectory, archiveDirectory);<br>zipArchive-&gt;Save(targetFile);<br><br>... which may or may not be relevant - the same original file encrypted <br>with different options using zipit.exe (specifically strategy not set <br>because you can't) extracts just fine, so I think it is something <br>fundamental to do with the resulting bit pattern (my first guess would <br>be its length aligning with block sizes, but only because that has <br>tripped me up in the past when parsing blocks from streams, but that may <br>just be my coding blind spot!) rather than anything to do with the <br>original data itself.<br><br>Anyway, I hope you can reproduce the problem with this info, otherwise <br>I'll look pretty foolish!<br>Many thanks for your time,<br>Stephen<br><br><br><br>On 18/10/2010 22:29, Cheeso wrote:<br>&gt;<br>&gt;<br>&gt; From: Cheeso<br>&gt;<br>&gt; yes, exactly. If I had the same zip I'd be able to troubleshoot and<br>&gt; diagnose much more easily.<br>&gt;<br>&gt; Any chance you can send it to me?<br>&gt;<br>&gt; Read the full discussion online<br>&gt; &lt;http://dotnetzip.codeplex.com/Thread/View.aspx?ThreadId=231352&ANCHOR#Post509001&gt;.<br>&gt;<br>&gt; To add a post to this discussion, reply to this email<br>&gt; ([email removed]<br>&gt; &lt;mailto:[email removed]?subject=[DotNetZip:231352]&gt;)<br>&gt;<br>&gt; To start a new discussion for this project, email<br>&gt; [email removed]<br>&gt; &lt;mailto:[email removed]&gt;<br>&gt;<br>&gt; You are receiving this email because you subscribed to this discussion<br>&gt; on CodePlex. You can unsubscribe<br>&gt; &lt;http://www.codeplex.com/site/discussions/thread/unsubscribe/231352&gt; on<br>&gt; CodePlex.com.<br>&gt;<br>&gt; Please note: Images and attachments will be removed from emails. Any<br>&gt; posts to this discussion will also be available online at CodePlex.com<br>&gt;",
    "PostedDate": "2010-10-19T02:51:13.693-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "509250",
    "ThreadId": "231352",
    "Html": "Having said that I've just spotted this at the bottom of your reply, so <br>now I am looking pretty foolish!  How do I get a file to you?!<br><br>&gt; Images and attachments will be removed from emails.",
    "PostedDate": "2010-10-19T03:03:22.67-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "511698",
    "ThreadId": "231352",
    "Html": "\r\n<p>You can just open a&nbsp;work item.&nbsp; go to <a href=\"http://dotnetzip.codeplex.com\">\r\nhttp://dotnetzip.codeplex.com</a>, then click the &quot;Issue Tracker&quot; link on the top horizontal navbar.</p>\r\n<p>Create a new workitem, and upload your relevant files there.</p>\r\n<p>I monitor both the discussions and the work item lists.&nbsp; (Work items are for things that almost certainly require changes to DotNetZip code, Discussions are for questions, clarifications, example code, etc).</p>\r\n<p>&nbsp;</p>\r\n",
    "PostedDate": "2010-10-24T05:59:03.43-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "514057",
    "ThreadId": "231352",
    "Html": "\r\n<p>Hi Cheeso,</p>\r\n<p>Just to let you know I'm also finding the same problem. I;ve encrypted in 128 and 254, but still the same issue.&nbsp; Like Bobby, it works with 7-zip, but not anythingelse I tried.&nbsp; Also the DotNetZip extract code I created, which works fine for unencrypted\r\n files, takes an extra long time to extract the zip of an ecrypted zip, upto the point before it fails.&nbsp; 7-Zip extracted the same zip of 400MB in less than a minuite, the DotNetZip code seems to take 5-10 mins before it crashed.</p>\r\n<p>Unfortunatly I've not got any zip doing this which hasn;t got sensitive data included.&nbsp; Let know know if you need one and I'l try and create one.</p>\r\n<p>Apart from this bug, which made me want to cry when I found it!!...DotNetZip has been a joy to work with..Thankyou and well done!!</p>\r\n<p>Regards,</p>\r\n<p>Dave.</p>\r\n",
    "PostedDate": "2010-10-28T09:15:28.393-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "514494",
    "ThreadId": "231352",
    "Html": "\r\n<p>Hi Dave,</p>\r\n<p>Interesting to see you having a similar issue - I have raised a work item (<span id=\"x_IssueIdLabel\">12361) and attached my example files (thankfully the data had been anonymised as part of testing prior to discovering this issue) there's a bit more info\r\n on there aswell, as I stepped through some of the decryption process with a debugger.&nbsp; Out of interest, what if any options do you set for Compression Level (speed vs size), and Compression Strategy (huffman, filtered or default), and what size is the\r\n resulting zipped file (7-zip should be able to tell you 'packed size' in bytes if you open the archive and do right click/properties on the file entry)?&nbsp; These may throw up some commonality with my example which may help rule out or highlight places to\r\n look for the issue.</span></p>\r\n<p>Cheers,</p>\r\n<p>Stephen</p>\r\n",
    "PostedDate": "2010-10-29T04:17:06.963-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "765687",
    "ThreadId": "231352",
    "Html": "<p>I'm having this same issue as well.&nbsp; It appears to occur for me for no apparent reason, and then appears to resolve itself just as quickly.</p>\n<p>Here's the stack trace:</p>\n<p>Ionic.Zip.BadStateException: The final hash has not been computed.<br />&nbsp;&nbsp; at Ionic.Zip.WinZipAesCipherStream.get_FinalAuthentication()<br />&nbsp;&nbsp; at Ionic.Zip.ZipEntry.VerifyCrcAfterExtract(Int32 actualCrc32)<br />&nbsp;&nbsp; at Ionic.Zip.ZipEntry.InternalExtract(String baseDir, Stream outstream, String password)<br />&nbsp;&nbsp; at Ionic.Zip.ZipFile._InternalExtractAll(String path, Boolean overrideExtractExistingProperty)<br />&nbsp;&nbsp; at DeployPrototype.ExtractionConfiguration.ExtractDeploymentFiles(String zipfiletoextract, String installdir)</p>",
    "PostedDate": "2012-02-14T16:37:44.4-08:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "858080",
    "ThreadId": "231352",
    "Html": "<p>Hi Dave,</p>\r\n<p>I'm seeing this issue as well. &nbsp;My applications processes zip archives created with version 1.9.1.5 of the library that fail to extract using either 1.9.1.5 or 1.9.1.8 of the library. &nbsp;The archives extract fine using either 7-Zip or WinRAR.</p>\r\n<p>Unfortunately, the data in the archives is highly proprietary so I can't provide samples for debugging. &nbsp;I process several hundred archives per day and the problem only affects a small fraction of them. &nbsp;So far I've been unable to reproduce the problem using \"sanitized\" contents that I could submit.</p>\r\n<p>Suggestions?</p>",
    "PostedDate": "2012-07-05T14:47:02.033-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "1048270",
    "ThreadId": "231352",
    "Html": "Hi, has there been any progress with this issue?\r<br />\n<br />\nI am also experiencing this with a particular set of files.  Other sets of files decompress fine.\r<br />\nThere are 3937 files and 3405 of them get unzipped successfully and it fails on the same file each time.  Even if the files are compressed again the same thing happens.<br />\n",
    "PostedDate": "2013-05-24T07:59:47.14-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  }
]