Tell me more ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I need to implement Zip32 (PK compatible) in C#. I can't just call a separate dll or exe because (1) I don't want to write the uncompressed file to disk and (2) I want to avoid the possibly that someone could wrap that library - either of these would compromise security.

My ideal solution would be to find a C# implementation of the Zip32 algorithm which I could use, and just modify it so I can pass a byte array or something.

Does anyone have any suggestions or (I dare but hope) examples of C# PKZip implementations?

Thanks all :)

share|improve this question
1  
If you are not stuck with the zip32 format, the .Net Framework provides built-in compression services for other formats : msdn.microsoft.com/en-us/library/3z72378a – Matthieu Jun 11 '12 at 15:53
1  
Yep, unfortunately I have to adhere to an older standard which stipulates PK compatible Zip32 compression. :( – bukko Jun 11 '12 at 15:59
I guess you were smart enough to make a google search before you posted your question and you have already excluded some of the freely available libraries like dotnetzip.codeplex.com for some reasons you want to tell us? Or are you specificially looking for a lib which can handle the proprietary extensions of the newer PKZIP versions? – Doc Brown Jun 11 '12 at 16:11
In case you find a native lib: here stackoverflow.com/questions/666799/… is a description how to embed native DLLs into managed assemblies. – Doc Brown Jun 11 '12 at 16:14
Can you tell us more about the security concern? – user16764 Jun 13 '12 at 14:25

closed as not constructive by maple_shaft Jun 13 '12 at 15:25

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or specific expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, see the FAQ for guidance.

2 Answers

Try SharpZipLib / #ziplib Quote from the webpage:

#ziplib (SharpZipLib, formerly NZipLib) is a Zip, GZip, Tar and BZip2 library written entirely in C# for the .NET platform. It is implemented as an assembly (installable in the GAC), and thus can easily be incorporated into other projects (in any .NET language). The creator of #ziplib put it this way: "I've ported the zip library over to C# because I needed gzip/zip compression and I didn't want to use libzip.dll or something like this. I want all in pure C#."

Alternatively, try using the 7-Zip SDK and specifing that the compression should use Zip32 compression.

share|improve this answer

Try to use DotNetZip You get all options of creating Zip.

share|improve this answer
would you mind explaining more on what it does and why do you recommend it as answering the question asked? "Link-only answers" are not quite welcome at Stack Exchange – gnat May 3 at 17:07
@gnat: I hope better you spend your time on open question not on close question. as per the query these .net dll for generating zip. – Saroop Trivedi May 4 at 4:29

Not the answer you're looking for? Browse other questions tagged or ask your own question.