Zip Component, Email Component, Encryption Component ActiveX Control for Zip Compression .NET Components for ASP.NET
ActiveX and .NET Components for Zip Compression, Encryption, Email, XML, S/MIME, HTML Email, Character Encoding, Digital Certificates, FTP, and more ASP Email ActiveX Component

Index of Chilkat Blog Posts

August 17, 2006

Encryption Component’s Charset Property

Question: I’ve been using the AES erncryption stuff, now I have a need to encrypt/decrypt TIF files, PDF, other binary, and plan to use Chilkat Crypt (for VB6).

One thing that has me mightily confused is the choice of an encoding scheme like Unicode etc.

What do I use when I am going to be using ckEncryptfile and decryptfile on binary files?
Also, why is there an encoding schene at all? Doesn’t AES just encrypt/decrypt binary bytes?

PS> I am planning to use AES/Rijndael with FIPS-1 padding.

Answer:The Charset property only comes into play for methods that accept string arguments or return strings. If you are passing a VB6 string to EncryptString for example, you are passing a Unicode string (2 bytes per character). If the string is long, and you know that it only contains us-ascii and/or latin-1 characters, you may wish to specify a Charset of "iso-8859-1″ so that you are encrypting 1-byte/character. Internal to Chilkat Crypt, your Unicode string will first be converted to the Charset and then encrypted. (For methods that encrypt binary data or files, the Charset property is ignored.)

Likewise, if you are decrypting to return a string, the result (in VB6) cannot be anything other than a Unicode string. If a C++ program (for example) encrypts an iso-8859-1 string (1-byte/char), the Chilkat component needs to know that after decryption it should convert from iso-8859-1 bytes to Unicode so it can return a VB6 string.

The CkEncryptFile and CkDecryptFile treat all files (even text) as binary bytes, and the Charset property is ignored.

Privacy Statement. Copyright 2000-2011 Chilkat Software, Inc. All rights reserved.
Send feedback to

Components for Microsoft Windows XP, 2000, 2003 Server, Vista, Windows 7, and Windows 95/98/NT4.