IPWorks ZIP 2020 Node.js Edition

Questions / Feedback?

EncryptionAlgorithm Property

The algorithm used to encrypt files written to the archive.

Syntax

 zip.getEncryptionAlgorithm([callback])
 zip.setEncryptionAlgorithm( encryptionAlgorithm, [callback])

Possible Values

  0 (eaDefault), 
  1 (eaAESWeak), 
  2 (eaAESStrong), 
  3 (eaAESMaximum)

Default Value

0

Callback

The 'callback' parameter specifies a function which will be called when the operation completes (or an error is encountered). If the 'callback' parameter is not specified, then the method will block and will not return until the operation completes (or an error is encountered).

The callback for the getEncryptionAlgorithm([callback]) method is defined as:

function(err, data){ }

'err' is the error that occurred. If there was no error, then 'err' is 'null'.

'data' is the value returned by the method.

The callback for the setEncryptionAlgorithm([callback]) method is defined as:

function(err){ }

'err' is the error that occurred. If there was no error, then 'err' is 'null'.

'err' has 2 properties which hold detailed information:

err.code
err.message

Remarks

The algorithm used to encrypt files written to the archive.

Note that files will only be encrypted if Password is set. By default the class will use standard zip encryption if Password is set, and will not encrypt data otherwise.

The class supports the use of AES, the Advanced Encryption Standard, as well as standard Zip encryption. The default encryption algorithm is the algorithm introduced in version 2.0 of the Zip specification, and is compatible with virtually all other zip utilities. However, this algorithm is considered weak and should not be used to protect sensitive data.

AES is a U.S. government standard cleared to protect even the most sensitive data. The file format used to create AES-encrypted files is designed to be compatible with WinZip 9.0. AES-encrypted files created by the class may or may not be compatible with other Zip utilities.

The class supports the use of AES with key lengths of 128, 192, or 256 bits. Note that even with the weakest (128-bit) keys AES is much more secure than standard Zip encryption.

If you use strong or maximum AES encryption the class will generate a unique salt value and cryptographic key for each file encrypted. If you use weak encryption the class will use the same salt for each file in the archive. If you are encrypting a large number of files this will have a substantial effect on performance. Set the AESGenerateUniqueKeys configuration setting to configure the salt generation independent of the key length.

If using AES encryption it is important to choose a good Password. For 128-bit keys it is recommended that your password be 32 characters long, and for 256-bit keys, 64 characters.

Important: Note that AES encryption only encrypts the contents of encrypted files within the Zip archive; it does not prevent an attacker from reading the names of files in the archive, or from adding or deleting files to or from the archive. To prevent this consider first storing your files in an unencrypted zip file, and then storing this zip file in another, AES-encrypted zip file.

Property values:

eaDefault0
eaAESWeak1
eaAESStrong2
eaAESMaximum3

Data Type

Integer

Copyright (c) 2022 /n software inc. - All rights reserved.
IPWorks ZIP 2020 Node.js Edition - Version 20.0 [Build 8300]