can we set password for zip file using minizip

核能气质少年 提交于 2020-03-25 03:56:11

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!