Visual C++ Examples

ChilkatHOMEAndroid™ASPVisual BasicVB.NETC#iOS (IPhone)Objective-CC++CUnicode C++Unicode CMFCDelphi DLLDelphi ActiveXFoxProJavaPerlPHP ExtensionPHP ActiveXPythonPowerShellRubySQL ServerVBScript

C++ Examples

CkString
Byte Array
Bounced Mail
Bz2
Character Encoding
CSV
DH Key Exchange
DKIM/DomainKeys
Digital Certificates
Digital Signatures
DSA
Email
Email Object
Encryption
FTP
HTML Conversion
HTTP
IMAP
MHT / HTML Email
POP3
RSA
S/MIME
SMTP
Socket
Spider
SSH Key
SSH
SSH Tunnel
SFTP
Tar
Upload
XML
XMP
Zip Compression


More Examples...
Amazon S3
NTLM
FileAccess
RSS
Atom
Self-Extractor
Service
PPMD
Deflate
Bzip2
LZW

 

 

 

 

 

 

 

 

256-bit AES Decrypt Hexidecimalized Encrypted String

Downloads:

MS Windows Visual C/C++ Libraries
Linux/CentOS C/C++ Libraries
MAC OS X C/C++ Libraries
Solaris C/C++ Libraries
C++ Builder Libraries
FreeBSD C++ Libraries
HP-UX C++ Libraries
BlackBerry QNX C++ Libraries

Demonstrates how to decrypt a string that was previously encrypted using 256-bit AES encrypted where the result is encoded to a hex string.

    // Decrypt a string using 256-bit AES encryption.  The encrypted
    // data is passed as a hexidecimalized string.
    CkCrypt2 crypt2;
    crypt2.UnlockComponent("anything for 30-day trial");

    crypt2.put_CryptAlgorithm("aes");
    crypt2.put_KeyLength(256);
    crypt2.put_EncodingMode("hex");

    // We are going to call DecryptStringENC which returns a string.
    // If the string that was encrypted was represented in some non-ascii
    // character encoding, we'll need to know about it in order to
    // interpret the characters of the decrypted string correctly.
    // In this case however, the string we are decrypting is us-ascii,
    // so we can leave the Charset alone...
    //crypt2.put_Charset("us-ascii");

    // Generate a binary secret key according to the KeyLength.
    // The SecretKey property is a byte array that can be set
    // directly by passing a byte array equal in bit-length to
    // the KeyLength, or you can let the CkCrypt2 class generate
    // a binary secret key given a password string.
    CkByteData secretKey;
    crypt2.GenerateSecretKey("myPassword",secretKey);
    crypt2.put_SecretKey(secretKey);

    CkString strDecrypted;
    crypt2.DecryptStringENC("4D55BBE6DFA47582EA3BC95D1EA8BBD6",strDecrypted);

    // The output of this example is: "Encrypt This!"
    printf("%s\n",strDecrypted.getString());
    
    // An example of a C# program that creates the encrypted string used
    // in this example is located here: C# 256-bit AES String Encryption

 

 

 

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