-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add password to ZipArchive #1545
Comments
It's certainly possible to add encryption support to ZipArchives. There are a few competing standards for which encryption and accompanying header definitions, but I think the AES one used by 7-zip is one of the more popular ones. There's also basic passwords included in the zip format but iirc those are easily crackable. The format also has some strong encryption support but it's copyrighted so out of bounds for us. |
We need API proposal to move it further. |
Speaks something against? namespace System.IO.Compression
{
public static class ZipFile
{
public static ZipArchive Open(String archiveFileName, ZipArchiveMode mode, Encoding entryNameEncoding, string password)
}
} |
@ianhays can you please comment if that is sufficient? |
@lburkovsky take a look at this issue for a good example of the kind of API proposal that we're looking for. In general, the more implementation details, the better. You can also look at our API Review process doc for more info on the process. For Zip password support specifically, an API proposal should include analysis on the different methods of password support in Zip, the pros and cons of each, and which you think should be officially supported in .NET. |
@neridonk perhaps you would like to make the proposal for us to formally review? as above. |
Any news or plans about this feature? Would be very useful! |
@mfjerome we are open to API proposal and contribution. Are you interested? |
What do we need this feature for? Is it for reading password-protected files or producing or something else? |
I'm not quite sure what's being asked of me here. So here are words.
All further comments relate to the WinZIp version:
The preference in cryptography API is to never have a default algorithm choice, so creating new encrypted ZIP files would require using a method that took that as an input. That might mean that instead of public static ZipArchive Open(String archiveFileName, ZipArchiveMode mode, Encoding entryNameEncoding, string password); You want public enum ZipEncryptionMode
{
Unknown,
Aes128,
Aes192,
Aes256,
}
public static ZipArchive OpenRead(string archiveFileName, Encoding entryNameEncoding, string password);
public static ZipArchive OpenCreate(string archiveFileName, Encoding entryNameEncoding, string password, ZipEncryptionMode encryptionMode);
public static ZipArchive OpenUpdate(string archiveFileName, Encoding entryNameEncoding, string password, ZipEncryptionMode encryptionMode); Or, you could combine them: public enum ZipEncryptionMode
{
Unknown,
Aes128,
Aes192,
Aes256,
}
// Update/Create modes will throw if newFileEncryptionMode is default
public static ZipArchive Open(string archiveFileName, Encoding entryNameEncoding, string password, ZipEncryptionMode newFileEncryptionMode = default); This is all unfortunate that you're holding the password string in memory. Being able to take it as a ReadOnlySpan would be nicer, but requires moving the encrypt/decrypt to verbs on ZipFileEntry (which may be useful anyways, for degenerate files that use multiple different passwords). So, short form:
|
I think this issue can resolve my feature needed in https://developercommunity.visualstudio.com/idea/368318/add-password-protected-zip-file-to-systemiocompres.html |
We need it. |
@jeffhandley @danmoseley I think it's a good .NET 7 candidate for the "Bottom Up" initiative |
Could well be. That's what the 7.0 milestone is for. |
So... can we extract Zips with passwords yet? .NET6-8+ |
So we have to use third party library? |
Can't believe this issue is still open |
dotnetzip is now no longer maintained. And this feature is still not implemented. |
need this, too |
This comment was marked as abuse.
This comment was marked as abuse.
Best I can think of is that, there's just too many compression and encryption methods. We ended up just using SharpZipLib, wasn't really too bad.
|
Need this also! |
@SteveL-MSFT Is there any update to put it on the roadmap by Microsoft? I don't wanna express my honest thoughts regarding this issue, but lets say @peter0302 kept it very polite... |
LOL they marked my comment as abuse. Imagine if I'd expressed my honest thoughts.
First it's a patent not a copyright: https://ppubs.uspto.gov/dirsearch-public/print/downloadPdf/11461487 Priority date is July 16, 2003 with a 242 day administrative extension, plus a 20 year term. That's March 14, 2024, meaning the patent is expired. Patent gone, carry on. Time to implement this. |
Absolutely the same feeling. I hope they can prioritize these fundamental experiences that have been missing for decades, so that we can love the .NET ecosystem even more. |
So that means we might actually get this feature added in future??? [Hopeful]
Sent from Proton Mail Android
…-------- Original Message --------
On 2024-07-19 11:50 a.m., peter0302 wrote:
> I don't wanna express my honest thoughts regarding this issue, but lets say ***@***.***(https://github.com/peter0302) kept it very polite...
LOL they marked my comment as abuse. Imagine if I'd expressed my honest thoughts.
> The format also has some strong encryption support but it's copyrighted so out of bounds for us.
First it's a patent not a copyright:
https://ppubs.uspto.gov/dirsearch-public/print/downloadPdf/11461487
Priority date is July 16, 2003 with a 242 day administrative extension, plus a 20 year term. That's March 14, 2024, meaning the patent is expired.
Time to implement this.
—
Reply to this email directly, [view it on GitHub](#1545 (comment)), or [unsubscribe](https://github.com/notifications/unsubscribe-auth/BHIU6D4Q7IVAHCP3VWWD7T3ZNEOBRAVCNFSM4KE7AGG2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMRTHEZDSMBVGMZA).
You are receiving this because you commented.Message ID: ***@***.***>
|
Above, and almost 8 years ago, ianhays commented [on Nov 3, 2016] @lburkovsky take a look at this issue for a good example of the kind of API proposal that we're looking for. In general, the more implementation details, the better. You can also look at our API Review process doc... Does anyone know if this was completed?.. (or still relevant in MS processes?) ... while I disagree this should be the reason why this is held up; it's also kinda sad if no one's completed it in almost 8 years. (I'm willing to.. presuming it's still a relevant process.) |
Super bummed. This not even possible then?
Sent from Proton Mail Android
…-------- Original Message --------
On 2024-07-19 12:02 p.m., 張 wrote:
> You have to be freakin kidding me. I just was about to add password support and started looking for ZipArchive constructor overloads that took a password, and not finding one, Googled it. This is the last thing I expected to see. What on earth is wrong with you people? How can this not be part of .NET's built-in Zip support? I don't even know what to say.
Absolutely the same feeling.
The support for compressed archive formats is probably the worst part of the .Net experience.
—
Reply to this email directly, [view it on GitHub](#1545 (comment)), or [unsubscribe](https://github.com/notifications/unsubscribe-auth/BHIU6D35JS3DDME4DFOWTMTZNEPPRAVCNFSM4KE7AGG2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMRTHEZTCNZXGQYQ).
You are receiving this because you commented.Message ID: ***@***.***>
|
It's 100% possible. Ionic supported it. The only understandable reason it appears MS didn't initially support it was the patent, which is now expired. So there's no reason not to do it now. |
Oh excellent. Effort to implement? Estimate?
Sent from Proton Mail Android
…-------- Original Message --------
On 2024-07-24 9:26 a.m., peter0302 wrote:
> Super bummed. This not even possible then?
It's 100% possible. Ionic supported it. The only understandable reason it appears MS didn't initially support it was the patent, which is now expired. So there's no reason not to do it now.
—
Reply to this email directly, [view it on GitHub](#1545 (comment)), or [unsubscribe](https://github.com/notifications/unsubscribe-auth/BHIU6D4DOALGDUP22RSVYR3ZN6I5JAVCNFSM4KE7AGG2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMRUG43TENBRGU4A).
You are receiving this because you commented.Message ID: ***@***.***>
|
I would suggest an API like this: public enum ZipEncryptionMode { Unknown, WinZipAes128, WinZipAes192, WinZipAes256 }
public class ZipFile
{
// current
public ZipArchiveEntry? GetEntry(string entryName);
public ZipArchiveEntry CreateEntry(string entryName);
public ZipArchiveEntry CreateEntry(string entryName, CompressionLevel compressionLevel);
// suggestion
public ZipArchiveEntry? GetEntry(string entryName, string? password, bool failIfUnencrypted = false);
public ZipArchiveEntry CreateEntry(string entryName, ZipEncryptionMode encryptionMode, string password);
public ZipArchiveEntry CreateEntry(string entryName, CompressionLevel compressionLevel, ZipEncryptionMode encryptionMode, string password);
}
public enum ZipCompressionMethod { Unknown, Store, Deflate, ... }
public class ZipArchiveEntry
{
// suggestion
public ZipEncryptionMode EncryptionMode { get; }
// additional suggestion
public ZipCompressionMethod CompressionMethod { get; }
} This allows for each entry to have a different (or no) password (which the WinZip standard allows). The enum values When decrypting the password alone should be enough (because the encryption mode is saved in the zip archive). When I think it would be beneficial to allow users to check the Any comments on my suggestions are appreciated. |
I would really appreciate your idea to encrypt each entry with a different password/method as DotNetZip also did. |
Regarding this API approach (#1545 (comment)), I would like to add, that the support of BasicEncryption would be useful and would like to add it to ZipEncryptionMode. |
Any estimate, when this feature will be implemented? Passwords are a pretty common use-case for zip archives in my opinion. |
can we make that happen?
The text was updated successfully, but these errors were encountered: