Chilkat HOME ASP Visual Basic VB.NET C# Visual C++ C MFC Delphi FoxPro Java Perl PHP Python Ruby SQL Server VBScript
|
MFC Rewrite AES Encrypted Zip (w/ Unicode CString)
Visual C++ 8.0 MFC Unicode example program using CString's demonstrating how to open an unencrypted .zip, set encryption params, and re-write it as a WinZip compatible AES encrypted zip. // Visual C++ MFC example program showing how
// to open an unencrypted Zip, change the encryption properties
// for WinZip AES encryption, and re-write.
//
// Also demonstrates how to use Unicode and CString with the
// Chilkat C++ libs.
CkString cks;
CkZip zip;
CString cs = _T("anything 30-day trial");
wchar_t *w = cs.GetBuffer();
cks.setStringU(w);
zip.UnlockComponent(cks.getString());
// Open a non-encrypted .zip
cs = _T("exampleData.zip");
cks.setStringU(cs.GetBuffer());
zip.OpenZip(cks.getString());
// 4 = WinZip compatible AES encryption.
zip.put_Encryption(4);
// Set the password...
cs = _T("secret");
cks.setStringU(cs.GetBuffer());
zip.SetPassword(cks.getString());
// Change the name of the .zip to be written.
// If this is omitted, the exampleData.zip would be overwritten.
cs = _T("encryptedZip.zip");
cks.setStringU(cs.GetBuffer());
zip.put_FileName(cks.getString());
// Write the zip.
zip.WriteZipAndClose();
zip.SaveLastError("writeZipLog.txt");
|
Need a specific example? Send a request to support@chilkatsoft.com
© 2000-2008 Chilkat Software, Inc. All Rights Reserved.