Chilkat HOME ASP Visual Basic VB.NET C# Visual C++ C MFC Delphi FoxPro Java Perl PHP Python Ruby SQL Server VBScript
|
Zip / Unzip with 128-bit AES encryption
Visual Basic example demonstrating how to Zip and Unzip with 128-bit AES encryption. ' Save an XML file to a 128-bit encrypted Zip
Private Sub Command1_Click()
Dim zip As New ChilkatZip2
' Anything works to begin the 30-day trial
zip.UnlockComponent "30-day trial"
zip.NewZip "hamlet.zip"
zip.AppendFiles "hamlet.xml", 0
' Choose 128-bit AES encryption (WinZip compatible)
zip.Encryption = 4
zip.EncryptKeyLength = 128
zip.SetPassword "hamlet"
success = zip.WriteZipAndClose()
If (success = 0) Then
MsgBox zip.LastErrorText
Else
MsgBox "AES Encrypted Zip Created"
End If
End Sub
' Open a 128-bit AES encrypted Zip and inflate the contents.
Private Sub Command2_Click()
Dim zip As New ChilkatZip2
' Anything works to begin the 30-day trial
zip.UnlockComponent "30-day trial"
' We can only open it if the password is correct.
zip.SetPassword "hamlet"
success = zip.OpenZip("hamlet.zip")
If (success = 0) Then
MsgBox zip.LastErrorText
Exit Sub
End If
' The data is automatically decrypted when it is accessed.
Dim e As ChilkatZipEntry2
Set e = zip.GetEntryByIndex(0)
Text1.Text = e.InflateToString(1)
zip.CloseZip
End Sub
|
Need a specific example? Send a request to support@chilkatsoft.com
© 2000-2008 Chilkat Software, Inc. All Rights Reserved.