Inflate from Zip to memory in C++

This example demonstrates how to inflate in-memory from a Zip in C++: CkZip zip; … // Assume we have a CkZip object and a .zip has been loaded. // It may have been loaded from a file by calling OpenZip, or from an // in-memory image of a .zip by calling OpenFromMemory. // (or any of the other CkZip.Open* methods) […]

Non-English String Literals in C++ Source Code

When a C++ compiler compiles a C++ source file, it must process the bytes according to a character encoding and that is typically ANSI.  ANSI is not a character encoding, it is simply a keyword that says “Use the default multi-byte character encoding for this computer based on its current locale.”   Therefore, if your program is originally written in Poland […]

Utf8 C++ property allows for utf-8 or ANSI “const char *”

All Chilkat C++ classes have a Utf8 property. For example: class CkEmail : public CkObject { public: CkEmail(); virtual ~CkEmail(); … bool get_Utf8(void) const; void put_Utf8(bool b); … const char *addFileAttachment(const char *fileName); … }; The Utf8 property controls how the bytes pointed by “const char *” arguments are interpreted. By default, “const char *” strings are interpreted as ANSI […]

C# Encrypting/Decrypting with Stream

This C# example demonstrates how to use Chilkat.Crypt2 to encrypt and decrypting using the .NET FileStream class: Chilkat.Crypt2 crypt = new Chilkat.Crypt2(); bool success = crypt.UnlockComponent("Anything for 30-day trial"); if (!success) { MessageBox.Show(crypt.LastErrorText); return; } crypt.CryptAlgorithm = "aes"; crypt.CipherMode = "cbc"; crypt.KeyLength = 128; crypt.SetEncodedIV("0000000000000000", "hex"); crypt.SetEncodedKey("abcdefghijklmnop", "ascii"); // Open input and output files as file streams… FileStream fsIn = […]

Choosing Correct C++ Library for Linking

When linking with a Chilkat C++ library, you must choose the .lib that matches your project’s “code generation” property setting. For example, in VC++ 8.0, these are the Chilkat .lib’s: ChilkatDbg.lib ChilkatDbgDll.lib ChilkatRel.lib ChilkatRelDll.lib If “Dll” is in the library name, it means that you are *not* statically linking with the C runtime libs. Just because your project produces a […]

C# 3DES (Triple-DES) Test Vector

This post provides C# sample code for matching a test vector (known answer test). 3DES Settings: ECB Mode 192-bit key (i.e. 3 8-bit keys) ASCII Key Bytes: 1234567890123456ABCDEFGH ASCII Text to Encrypt: The quick brown fox jumped over the lazy dog Pads with zero bytes Hexadecimalized Encrypted Result: 13d4d3549493d2870f93c3e0812a06de467e1f9c0bfb16c0 70ede5cabbd3ca62f217a7ae8d47f2c7bf62eb309323b58b C# Code: string keyAscii = “1234567890123456ABCDEFGH”; byte[] key = ASCIIEncoding.ASCII.GetBytes(keyAscii); […]