When exchanging files from Window computer users, it would be nice if a Mac user could create a zip archive files from the command line that support the WinZip AES256 encryption scheme. The built in zip and unzip tools that come with Mac OS X only support the weaker WinZip/PKZip encryption process.

Regular Zip Archives

To create a zip archive file from the command line is pretty straight forward. Lets say you have a file called resume.txt and you would like to wrap it up in a zip archive, the command would be.

$ zip resume.zip resume.txt

If you wanted to add additional file to the archive, you would add the filenames to the end of the same command.

$ zip resume.zip resume.txt cover-letter.txt <file03> <file04>

To pull a zip archive file list, run the unzip command with the list -l option.

$ unzip -l resume.zip

Archive:  resume.zip
  Length     Date   Time    Name
 --------    ----   ----    ----
        6  08-23-14 14:41   resume.txt
       69  08-23-14 14:43   cover-letter.txt
 --------                   -------
       75                   2 files

All of these commands are handy, but they will not help us when we need to work with zip archives using the more updated AES256 encryption scheme.

AES256 Encrypted Zip Files

Using Homebrew, one can install the Posix port of the 7-zip project, which does support the WinZip AES256 encryption scheme.

$ brew update
$ brew install p7zip

Once installed, run the command 7za to access the program. The command below builds a new AES256 encrypted zip archive with the password “cookie77MONSTER”.

$ 7za a -tzip '-pcookie77MONSTER' -mem=AES256 resume02.zip resume.txt cover-letter.txt

To get a list of the contents, run either the unzip -l command or the 7za l.

$ 7za l resume02.zip

7-Zip (A) [64] 9.20  Copyright (c) 1999-2010 Igor Pavlov  2010-11-18
p7zip Version 9.20 (locale=utf8,Utf16=on,HugeFiles=on,8 CPUs)

Listing archive: resume02.zip

Path = resume02.zip
Type = zip
Physical Size = 401

   Date      Time    Attr         Size   Compressed  Name
------------------- ----- ------------ ------------  ------------------------
2014-08-23 14:43:44 .....           69           97  cover-letter.txt
2014-08-23 14:41:04 .....            6           34  resume.txt
------------------- ----- ------------ ------------  ------------------------
                                    75          131  2 files, 0 folders

The unzip command reports as follows.

$ unzip resume02.zip
Archive:  resume02.zip
   skipping: cover-letter.txt        need PK compat. v5.1 (can do v2.1)
   skipping: resume.txt              need PK compat. v5.1 (can do v2.1)

GUI Clients

If you would prefer using a GUI client, WinZip sells a nice Mac version for $30 USD.
The encryption scheme defaults to the older version, so be sure to select the AES256 option in the preference window.

WinZip Preference Screen Shot

— Chris