问题
I want to set password for zip files using minizip.I didn't find an documentation regarding this.I know we can encrypt all the zipped file.
回答1:
A complete example using C code is provided in the /contrib/minizip directory: minizip.c for the compression, miniunzip.c for the decompression. As said in the previous comment zipOpenNewFileInZip3 is for compression with password. For decompression you have to open the zipped file(s) with unzOpenCurrentFilePassword.
回答2:
Googling:
err = zipOpenNewFileInZip3_64(zf,savefilenameinzip,&zi,
NULL,0,NULL,0,NULL /* comment*/,
(opt_compress_level != 0) ? Z_DEFLATED : 0,
opt_compress_level,0,
/* -MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY, */
-MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY,
password,crcFile, zip64);
Taken from here.
If you use from command line:
minizip [-p password]
来源:https://stackoverflow.com/questions/24756268/can-we-set-password-for-zip-file-using-minizip