Xceed Zip Compression Library Documentation
EncryptionPassword property (Xceed Zip control)
Xceed Zip control reference > Xceed Zip control properties > EncryptionPassword property (Xceed Zip control)

The EncryptionPassword property contains the case-sensitive password to be used for encrypting or decrypting files.

The password specified in the EncryptionPassword property applies to all the files being zipped, unzipped or tested. To be able to specify different passwords for each file, use the ZipPreprocessingFile or UnzipPreprocessingFile events which are triggered for each file before it is zipped, unzipped or tested.

If the EncryptionPassword property is left empty before executing the Unzip or TestZipFile methods, and no password is provided using the UnzipPreprocessingFile event, then no encrypted files will be unzipped or tested. The SkippingFile event is triggered for each file skipped because of a missing or incorrect password.

If the EncryptionPassword property is empty before executing the Zip method, and no password is provided using the ZipPreprocessingFile event, then any newly zipped files will not be encrypted. Files that are already in the zip file will remain in their current state (either non-encrypted or encrypted) and must be rezipped in order to change them from non-encrypted to encrypted files and vice-versa.

Passwords can be up to 79 characters long.

Data type

String

Default value

Empty

Declaration (DLL API)  

UINT XzGetEncryptionPassword( HXCEEDZIP hZip, TCHAR* pszBuffer, UINT uMaxLength )
void XzSetEncryptionPassword( HXCEEDZIP hZip, const TCHAR* pszValue )

Remarks

The default   encryption algorithm used by the Xceed Zip Compression Library is the same one used by the PKZIP 2.04g program. This type of encryption can resist attacks by amateurs if the password is well chosen and long enough (at least 16 characters) but it will probably not resist attacks by determined users or experts. Therefore, we suggest that you always use long passwords, and when possible, do not rely solely on this encryption system to protect sensitive data.

For greater protection, AES encryption can be used by setting the EncryptionMethod property to xemWinZipAES. 

Version 6.0 of Xceed Zip Compression Library introduces AES encryption support. Because of export restrictions in some countries, a new license validation had to be implemented. License keys that begin with "ZIP" enable AES encryption support while "ZIL" license keys, either trial or registered, do not activate AES encryption support.

When zipping in trial mode with a "ZIP" (ZIP60 or more recent) license key, if the EncryptionMethod property is set to xemWinZipAES, the EncryptionPassword property will be changed to "This is a trial password" only if it had been modified prior to setting the EncryptionMethod property. If a password other than "This is a trial password" is specified in the EncryptionPassword property after the EncryptionMethod property has been set, a "Set not permitted" error will be thrown. The password can also be specified via the ZipPreprocessingFile event however if a password other than "This is a trial password" is specified, the SkippingFile event will be raised with a xsrNotLicenced skipping reason.

When unzipping an AES-encrypted zip file in trial mode with a "ZIP" license key, the only password that can be used is "This is a trial password" and it must be specified via the EncryptionPassword property, InvalidPassword event, or UnzipPreprocessingFile event. If a password other than "This is a trial password" is specified, the SkippingFile event will be raised with a xsrNotLicenced skipping reason. When unzipping, the EncryptionMethod property does not need to be set.

For both registered and trial "ZIP" and "ZIL" license keys, if the EncryptionPassword property is an empty string, the files will not be encrypted regardless of the value of the EncryptionMethod.

Applicable methods

Zip, Unzip, TestZipFile

See Also

Creating secure passwords