[
  {
    "Id": "486158",
    "ThreadId": "225222",
    "Html": "<p>I am attempting to create an encrypted zip with a 3rd party crypto library. I've reduced the problem down to a simple example. I am attempting to add a directory and save it to a CryptoStream, but it fails with the CountingStream ctor, because Position is not available to a CryptoStream. Basically:</p>\r\n<p>using (ICryptoTransform encryptor = _ctx.Algorithm.CreateEncryptor())<br>using (FileStream outputStream = GetWriteableFileStream(_outputFilename))<br>using (CryptoStream cryptoStream = GetWriteCryptoStream(outputStream, encryptor))<br>{<br>&nbsp;&nbsp;&nbsp;&nbsp; using (ZipFile zip = new ZipFile())<br>&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; zip.AddDirectory(_directory);<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; zip.Save(cryptoStream);<br>&nbsp;&nbsp;&nbsp;&nbsp; }</p>\r\n<p>}</p>\r\n<p>The problem is, I get an exception that the stream does not support seeking. Reading the documentation at http://cheeso.members.winisp.net/DotNetZipHelp/html/8b981f77-742a-5f47-6299-c27104871d8c.htm</p>\r\n<p>suggests that this is possible. Should CountingStream check Stream.CanSeek before trying to read Stream.Position?</p>\r\n<p>Thanks for any help you can offer.</p>",
    "PostedDate": "2010-08-29T10:54:09.943-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  },
  {
    "Id": "486892",
    "ThreadId": "225222",
    "Html": "Sounds plausible.  I thought I handled that case, but it's possible I did not.  I'll have a look. ",
    "PostedDate": "2010-08-31T05:29:09.427-07:00",
    "UserRole": null,
    "MarkedAsAnswerDate": null
  }
]