Are there any compression and encryption libraries in C#?

By : Niyaz
Source: Stackoverflow.com
Question!

I want to compress some files (into the ZIP format) and encrypt them if possible using C#. Is there some way to do this?

Can encryption be done as a part of the compression itself?

By : Niyaz


Answers

For compression, look at the System.IO.Compression namespace and for encryption look at System.Security.Cryptography.

By : Skizz


I know the question is already old, but I must add my two cents.

First, some definitions:

  • Zip: Archive format for regrouping files and folders into a single file, and optionally encrypting data.
  • Deflate: One of the compression algorithms used within a Zip file to compress the data. The most popular one.
  • GZip: A single file compressed with deflate, with a small header and footer.

Now, System.IO.Compression does not do Zip archiving. It does deflate and gzip compression, thus will compress a single blob of data into another single blob of data.

So, if you're looking for an archive format that can group many files and folders, you need Zip libraries like:

If you only need to compress and encrypt a single blob of data, then look under System.IO.Compression and System.Security.Cryptography.



Chilkat provides .NET libraries for compression and encryption.



This video can help you solving your question :)
By: admin