The InvalidPassword event is triggered the first time an encrypted file is encountered when unzipping or testing files. The event allows you to supply a decryption password to be used in order to decrypt the file and therefore be able to unzip it. The InvalidPassword event is also triggered whenever files are encountered that cannot be decrypted with the password supplied the last time the InvalidPassword event was triggered.
When unzipping files, if no handler is written for the InvalidPassword event, encrypted files will not be unzipped or tested. If an incorrect password is supplied, the InvalidPassword event will be triggered again until either the correct password is supplied, or the command is issued to skip the current file being unzipped or tested.
Note that the SkippingFile event occurs for any encrypted files that are skipped due to an invalid password or if Xceed Zip is instructed to skip the current file being unzipped.
Declaration | |
---|---|
Event InvalidPassword(sFilename As String, sNewPassword As String, bRetry As Boolean) |
Declaration (DLL API) | |
---|---|
xcdInvalidPasswordParams * pParams = ( xcdInvalidPasswordParams * ) lParam; |
Parameter | Modifiable | Description |
---|---|---|
sFilename | NO | The filename of the file that requires the password in order to be decrypted. |
sNewPassword | YES | Provide the encryption password here. |
bRetry | YES | Set this to True if you have provided a new password. Leaving this parameter to False (the default value it has when the event is triggered) will cause Xceed Zip to skip the file from being unzipped. |
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.