Chilkat
HOME
Android™
ASP
Visual Basic
VB.NET
C#
iOS (IPhone)
Objective-C
C++
C
MFC
Delphi
FoxPro
Java
Perl
PHP Extension
PHP ActiveX
Python
PowerShell
Ruby
SQL Server
VBScript
AES String EncryptionAES string encryption in C. 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 #include <C_CkCrypt2.h> void ChilkatSample(void) { HCkCrypt2 crypt; BOOL success; const char * password; const char * hexKey; const char * text; const char * encText; const char * decryptedText; crypt = CkCrypt2_Create(); success = CkCrypt2_UnlockComponent(crypt,"Anything for 30-day trial"); if (success != TRUE) { printf("Crypt component unlock failed\n"); return; } password = "secretPassPhrase"; CkCrypt2_putCryptAlgorithm(crypt,"aes"); CkCrypt2_putCipherMode(crypt,"cbc"); CkCrypt2_putKeyLength(crypt,128); // Generate a binary secret key from a password string // of any length. For 128-bit encryption, GenEncodedSecretKey // generates the MD5 hash of the password and returns it // in the encoded form requested. The 2nd param can be // "hex", "base64", "url", "quoted-printable", etc. hexKey = CkCrypt2_genEncodedSecretKey(crypt,password,"hex"); CkCrypt2_SetEncodedKey(crypt,hexKey,"hex"); CkCrypt2_putEncodingMode(crypt,"base64"); text = "The quick brown fox jumped over the lazy dog."; // Encrypt a string and return the binary encrypted data // in a base-64 encoded string. encText = CkCrypt2_encryptStringENC(crypt,text); printf("%s\n",encText); // Decrypt and show the original string: decryptedText = CkCrypt2_decryptStringENC(crypt,encText); printf("%s\n",decryptedText); CkCrypt2_Dispose(crypt); } |
Need a specific example? Send a request to support@chilkatsoft.com
© 2000-2010 Chilkat Software, Inc. All Rights Reserved.