sanyam jain
sanyam jain

Reputation: 135

can we set password for zip file using minizip

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.

Upvotes: 2

Views: 2276

Answers (2)

sassi67
sassi67

Reputation: 77

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.

Upvotes: 2

Luca Davanzo
Luca Davanzo

Reputation: 21520

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]

Upvotes: 1

Related Questions