none
System.IO.Compression and Passwords

    Question

  • Does System.IO.Compression support passwords and if so is it documented somewhere? I've been searching but been unable to find anything.

    Thanks

    Rodney


    Rodney Buxton

    Monday, November 30, 2015 6:40 PM

Answers

All replies

  • No. You need 3rd party libraries to do password enabled compression.
    • Marked as answer by Rodney Buxton Tuesday, December 1, 2015 12:51 PM
    Tuesday, December 1, 2015 1:23 AM
    Answerer
  • Thank you,

    I was afraid that would be the answer and once again it is disappointing to see that Microsoft only provides half of a solution.

    Rodney


    Rodney Buxton

    Tuesday, December 1, 2015 12:51 PM
  • u are looking at the wrong approach, this has nothing to do with m$

    io.compression **purpose** is to compress big size of file into smaller size, it is not mean for security

    a simple google for password security can yield tons of results, have u look into encryption or hashing?

    Wednesday, December 2, 2015 4:33 AM
  • Thank you,

    I was afraid that would be the answer and once again it is disappointing to see that Microsoft only provides half of a solution.

    Rodney


    Rodney Buxton

    I see you marked cheong00's post as the answer.

    Were you trying to use something which would be compatible with 3rd party capabilities that perform this in some fashion such that you could use this namespace with password to compress something and it would be compatible with 3rd party which could decompress what you compressed using same password or something like that?

    Otherwise if this ability was only to be used with your app such that no other app would be capable of accessing your compressed data even with valid password then you could write code that performs along those lines using this namespace and some other(s).

    I used RSA  to encrypt password and some other encrypted info then add that to a as bytes to a List(Of Byte). Then compress selected folder and all files, sub folders and their files. Then encrypt that data. The encrypted password and some other encrypted info is separated from the compressed/encrypted folder, files and subfolders and their files by a clear byte sequence. When decompressing the app checks for the RSA key and password used if the decrypted byte sequence at the beginning of the file selected to decrypt/decompress contains the password being used and if not the file isn't decrypted and decompressed back into a folder containing files and any subfolders and their files basically. But it's all one off in that it would not work with third party software.


    La vida loca

    Wednesday, December 2, 2015 5:47 AM
  • FYI, SharpZipLib is free, actively maintained and available from the days of .NET v1.x and easily accessible on NuGet. No need to get your hand dirty on this task.

    Wednesday, December 2, 2015 6:29 AM
    Answerer