Visual C++ Examples

ChilkatHOMEASPVisual BasicVB.NETC#Visual C++CMFCDelphiFoxProJavaPerlPHPPythonRubySQL ServerVBScript

Visual C++ Examples

CkString
Byte Array
Bounced Mail
Character Encoding
Digital Certificates
Digital Signatures
Email
Encryption
FTP
HTML-to-XML
HTTP
IMAP
MHT / HTML Email
RSA Encryption
S/MIME
Socket
Spider
Tar
Upload
XML
XMP
Zip Compression


More Examples...
Email Object
POP3
SMTP
RSS
Atom
Self-Extractor

Unreleased...
Service
PPMD
Deflate
Bzip2
LZW
Bz2
DH Key Exchange
DSA
Icon

 

 

 

 

 

 

 

 

EncryptEncoded: Decode-->Encrypt Bytes-->Encode

In some programming languages, it is very difficult to work with binary data. To help avoid these problems, two new methods have been added to the Chilkat Crypt2 component: EncryptEncoded and DecryptEncoded.

EncryptEncoded takes binary data in the form of an encoded string (base64, hex, etc.), decodes it, encrypts, and then encodes the encrypted output and returns an encoded string (base64, hex, etc.).

DecryptEncoded does the opposite. It accepts encrypted data in the form of an encoded string, decodes, decrypts, and then returns the result as an encoded string.

The encoding is determined by the EncodingMode property. It may be "base64", "hex", "url", "quoted-printable", etc.

Note: The EncryptEncoded and DecryptEncoded methods are unreleased at the time of this writing (08-April-2008) The next major Chilkat Crypt2 release after this date will include these new methods.

Download Chilkat C/C++ Libraries for VC++ 9.0 / Win32

Download Chilkat C/C++ Libraries for VC++ 8.0 / Win32

Download Chilkat C/C++ 64-bit Libraries for VC++ 8.0 / x64

Download Chilkat Visual Studio 2005 C/C++ Libs for Windows Mobile, Pocket PC, SmartPhone, WinCE

Download Chilkat C/C++ Libraries for VC++ 7.0 / Win32

Download Chilkat C/C++ Libraries for VC++ 6.0 / Win32

Download Chilkat C/C++ Libraries for VC++ 6.0, Win 95/98/NT4 Compatible

#include <CkCrypt2.h>

void ChilkatSample(void)
    {
    CkCrypt2 crypt;

    bool success;
    success = crypt.UnlockComponent("Anything for 30-day trial");
    if (success != true) {
        //  Unlock failed.
        printf("%s\n",crypt.lastErrorText());
        return;
    }

    crypt.put_CryptAlgorithm("aes");
    crypt.put_KeyLength(128);

    //  The encrypted output will be a hex-encoded string.
    //  It is also possible to use "base64", "url" (for url-encoding), and other modes.
    crypt.put_EncodingMode("hex");

    //  Both ECB and CBC modes are available.
    //  Use "ecb" for Electronic Cookbook Mode.
    //  "cbc" is for Cipher-Block-Chaining.
    crypt.put_CipherMode("ecb");

    //  Key (128): E8E9EAEBEDEEEFF0F2F3F4F5F7F8F9FA
    //  Plaintext: 014BAF2278A69D331D5180103643E99A
    //  Ciphertext: 6743C3D1519AB4F2CD9A78AB09A511BD

    crypt.SetEncodedKey("E8E9EAEBEDEEEFF0F2F3F4F5F7F8F9FA","hex");

    crypt.put_PaddingScheme(3);

    const char * cipherHex;
    const char * plainTextHex;

    cipherHex = crypt.encryptEncoded("014BAF2278A69D331D5180103643E99A");
    printf("%s\n",cipherHex);

    plainTextHex = crypt.decryptEncoded(cipherHex);
    printf("%s\n",plainTextHex);
    }

Need a specific example? Send a request to support@chilkatsoft.com

© 2000-2008 Chilkat Software, Inc. All Rights Reserved.

Mail Component · .NET Mail Component · XML Parser