![]()  | 
  
Chilkat  HOME  Android™  AutoIt  C  C#  C++  Chilkat2-Python  CkPython  Classic ASP  DataFlex  Delphi DLL  Go  Java  Node.js  Objective-C  PHP Extension  Perl  PowerBuilder  PowerShell  PureBasic  Ruby  SQL Server  Swift  Tcl  Unicode C  Unicode C++  VB.NET  VBScript  Visual Basic 6.0  Visual FoxPro  Xojo Plugin
 
      (AutoIt) Encrypt Already Existing ZipTo encrypt an already existing non-encrypted .zip, the application must open the .zip, set the encryption related properties, and then re-write. 
 ; This requires the Chilkat Zip API to have been previously unlocked. ; See Unlock Chilkat Zip for sample code. $oZip = ObjCreate("Chilkat.Zip") ; Open an unencrypted .zip Local $bSuccess = $oZip.OpenZip("qa_data/zips/test.zip") If ($bSuccess <> True) Then ConsoleWrite($oZip.LastErrorText & @CRLF) Exit EndIf ; Unzip to a temp directory. Local $iNumFilesUnzipped = $oZip.Unzip("qa_output/tmp") If ($iNumFilesUnzipped < 0) Then ConsoleWrite($oZip.LastErrorText & @CRLF) Exit EndIf ; Clear the zip object. $oZip.NewZip("qa_output/aesTest.zip") ; Indicate that 128-bit AES encryption is to be used when writing the .zip $oZip.Encryption = 4 $oZip.EncryptKeyLength = 128 ; Set the password. $oZip.EncryptPassword = "secret" ; Append the files. $oZip.AppendFromDir = "qa_output/tmp" $bSuccess = $oZip.AppendFiles("*.*",True) If ($bSuccess <> True) Then ConsoleWrite($oZip.LastErrorText & @CRLF) Exit EndIf ; Write the .zip and close it. $bSuccess = $oZip.WriteZipAndClose() If ($bSuccess <> True) Then ConsoleWrite($oZip.LastErrorText & @CRLF) Exit EndIf ConsoleWrite("Success." & @CRLF)  | 
  ||||
© 2000-2025 Chilkat Software, Inc. All Rights Reserved.