Chilkat HOME Android™ ASP Visual Basic VB.NET C# iOS (IPhone) Objective-C C++ C Unicode C++ Unicode C MFC Delphi DLL Delphi ActiveX FoxPro Java Perl PHP Extension PHP ActiveX Python PowerShell Ruby SQL Server VBScript
256-bit AES Decrypt Hexidecimalized Encrypted StringDownloads: 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.