You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The zip reader and writer interface provides support for extended hash algorithms for zip entries, compression of the central directory, and the adding and verifying of CMS signatures for each entry. In order to add support for these features, extrafields were added and are described in the minizip extrafield documentation.
Limitations
Archives are required to have a central directory unless recovery mode is enabled.
Central directory header values should be correct and it is necessary for the compressed size to be accurate for encryption.
Central directory is the only data stored on the last disk of a split-disk archive and doesn't follow disk size restrictions.
Third-Party Limitations
Windows Explorer zip extraction utility does not support disk splitting. 1
macOS archive utility does not properly support ZIP files over 4GB. 12
<
5682
div class="markdown-heading" dir="auto">
Zlib Configuration
By default, if zlib is not found, it will be pulled as an external project and installed. This requires Git to be installed and available to your command interpreter.
To specify your own zlib repository use ZLIB_REPOSITORY and/or ZLIB_TAG.
To specify your own zlib installation use ZLIB_LIBRARY and ZLIB_INCLUDE_DIR.
Compiling with Zlib-ng
To compile using zlib-ng use the following cmake args:
If you are using CMAKE it will automatically include all the files and define all the #defines
required based on your configuration and it will also build the project files necessary for your platform.
However, for some projects it may be necessary to drop in the new files into an existing project. In that
instance, some #defines will have to be set as they have changed.
1.x
2.x
Description
HAVE_ZLIB
Compile with ZLIB library. Older verisons of Minizip required ZLIB. It is now possible to alternatively compile only using liblzma library.
HAVE_LZMA
Compile with LZMA support.
HAVE_BZIP2
HAVE_BZIP2
Compile with BZIP2 library support.
HAVE_APPLE_COMPRESSION
HAVE_LIBCOMP
Compile using Apple Compression library.
HAVE_AES
HAVE_WZAES
Compile using AES encryption support.
HAVE_PKCRYPT
Compile using PKWARE traditional encryption support. Previously this was automatically assumed.
NOUNCRYPT
Nearest to MZ_ZIP_NO_ENCRYPTION
Previously turn off all decryption support.
NOCRYPT
Nearest to MZ_ZIP_NO_ENCRYPTION
Previously turned off all encryption support.
MZ_ZIP_NO_ENCRYPTION
Turns off all encryption/decryption support.
NO_ADDFILEINEXISTINGZIP
Not currently supported.
IOWIN32_USING_WINRT_API
MZ_WINRT_API
Enable WinRT API support in Win32 file I/O stream.
MZ_ZIP_NO_COMPRESSION
Intended to reduce compilation size if not using zipping functionality.
MZ_ZIP_NO_COMPRESSION
Intended to reduce compilation size if not using zipping functionality.
At a minimum HAVE_ZLIB and HAVE_PKCRYPT will be necessary to be defined for drop-in replacement. To determine which files to drop in, see the Contents section of the README.
The compatibility layer for 1.x does not currently provide support for the ioapi interface; it has been replaced with a new streaming interface. It is possible to create a stream interface in a similar way that you would have created an ioapi interface.
Security Considerations
WinZip AES
When compressing an archive with WinZIP AES enabled, by default it uses 256 bit encryption. During decompression minizip will use whatever bit encryption was specified when the entry was added to the archive.
WinZip AES encryption uses CTR on top of ECB which prevents identical ciphertext blocks that might occur when using ECB by itself. More details about the WinZIP AES format can be found in the winzip documentation.
How to Create a Secure Zip
In order to create a secure zip file you must:
Use WinZIP AES encryption
Zip the central directory
Sign the zip file using a certificate
The combination of using AES encryption and zipping the central directory prevents data leakage through filename exposure.