Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Library for Unzipping password protected file

I need to unzip password protected file.

I am asking for library to include to my Windows project, not utility.

Requirements:

  • password supported
  • C or C++
  • not MFC-depended
  • wish it not be DLL(as they are usualy compiled in some incompatible mode)

Already searched SO and Google, unfortunately no libraries found yet.

  • most recommended "zlib" doesn't support passwords;
  • "Zip Utils" by Lucian Wischick (here) is nice, but there's a bug - extracted file is cropped at end;
  • another library I found is MFC-depended.

I can't believe there is no solution for this simple task in 2012. Please help.

like image 974
Nex Avatar asked Oct 16 '25 10:10

Nex


2 Answers

Ended up using "Zip Utils" by Lucian Wischick.

There was a bug - extracted file is cropped by 12 bytes at end. I found out how to fix it.

To fix this bug, delete line 3657 in file "unzip.cpp":

pfile_in_zip_read_info->rest_read_uncompressed-=uDoEncHead;
like image 103
Nex Avatar answered Oct 19 '25 00:10

Nex


UPDATED: use 7-zip as a library

Test if your password protected file can be decompressed with 7-zip.
If that is the case, then you should be able to use the codebase (as a dll).

The tool has support for zip decompression (ZlibDecoder) and 2 possible different encryption techniques (ZipCrypto & ZipStrong).


As for instructions how to use it, the 7-zip file manager tool uses the 7-zip dll to do all the work. You will need to look at the source code of the command line tool 7z.

like image 26
user1055604 Avatar answered Oct 19 '25 01:10

user1055604