mirror of
https://github.com/adamhathcock/sharpcompress.git
synced 2026-02-04 05:25:00 +00:00
Cannot open encrypted zip file - NotSupportedException #468
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @henning-krause on GitHub (Jul 28, 2021).
Hi,
I think I ran accross a similiar problem as @ArunaVignesh in #504.
When I open my Zip file using
I get this NotSupportedException:
cfef228afc/src/SharpCompress/Common/Zip/ZipHeaderFactory.cs (L117-L121)For my file, these are the entryHeader properties:
entryHeader.IsDirectory: false
entryHeader.CompressedSize: 0
entryHeader.Flags: Encrypted, Bit1, UsePostDataDescriptor, Efs
I'm happy to work on this issue and and provide a PR, but I'm not really sure if the changes that @ArunaVignesh suggested are viable.
Any help on why that check is there would be appreciated.
@adamhathcock commented on GitHub (Aug 17, 2021):
Not all zip files can be read in a non-seekable way. The knowledge of things like size would need to be in the post data descriptor header if you're using
ReaderFactoryIf this header doesn't exist then it needs the zip dictionary which must be seeked upon to read. This is done usingArchiveFactory@bhaeussermann commented on GitHub (May 5, 2025):
@adamhathcock I'm facing the same problem with my zip file as the one reported in this issue, so I tried using
ArchiveFactoryas suggested as follows:However, it's failing to identify the file as a valid zip as it's failing with the following exception:
Any suggestions on how to deal with this type of zip file?
@adamhathcock commented on GitHub (May 6, 2025):
Is it actually a valid zip file? What was it produced with? I'd need a sample before taking a look as it way it's failing.
@bhaeussermann commented on GitHub (May 8, 2025):
@adamhathcock The zip file must be valid as it can be unzipped using a zip application (eg. 7-zip).
Unfortunately, I cannot share the file as it contains sensitive information. I also don't know how it was produced.
@BartRennes commented on GitHub (Jun 18, 2025):
I have the same problem, i tried with all methods but it fails each time, the error message:
cannot currently read non-seekable Zip Streams with encrypted data that has been written in a non-seekable manner.
It is password protected, i can send you the file to test but only in private.
@jbrockerville commented on GitHub (Jul 4, 2025):
Following. I too am facing this issue and, unfortunately, also cannot share the files. @BartRennes did you end up sending your sample? Any progress?
@adamhathcock commented on GitHub (Jul 7, 2025):
It's probably not a bad zip file if gets to that error. Just a missing feature which hasn't been implemented
@BartRennes commented on GitHub (Jul 7, 2025):
I didn't received answer to send the file sample, no progress, i added a new lib (SharpZipLib) to avoid this problem with SharpCompress.