AES-256 and legacy Zip 2.0 encryption for Zip files.
Plugin for archiver that adds encryption capabilities to Zip compression. Pure JS, no external zip software needed.
npm install archiver-zip-encrypted --save
const archiver = ;// register format for archiver// note: only do it once per Node.js process/application, as duplicate registration will throw an errorarchiver;// create archive and specify method of encryption and passwordlet archive = archiver;archive// ... add contents to archive as usual using archiver
Plugin supports 2 encryption methods:
- 'aes256' - this is implementation of AES-256 encryption introduced by WinZip in 2003. It is the most safe option in regards of encryption, but limits possibilities of opening resulting archives. It's known to be supported by recent versions 7-Zip and WinZip. It is NOT supported by Linux unzip 6.00 (by Info-Zip). It is also NOT supported by Windows explorer (i.e. not possible to open Zip file as folder), even in Windows 10.
- 'zip20' - this is implementation of legacy Zip 2.0 encryption (also called "ZipCrypto" in 7-Zip application). This is the first encryption method added to Zip format and hence is widely supported, in particular by standard tools in Linux and Windows. However its security is proven to be breakable so I would not recommend using it unless you absolutely have to make it work w/o external software.
For more information on these encryption methods and its drawbacks in particular see WinZip documentation. It's worth noting that neither of these encryption methods encrypt file names and their metainformation, such as original size, filesystem dates, permissions etc.