Delphi Examples

ChilkatHOMEASPVisual BasicVB.NETC#Visual C++CMFCDelphiFoxProJavaPerlPHPPythonRubySQL ServerVBScript

Delphi Examples

Bounced Mail
Bz2
Character Encoding
CSV
DKIM / DomainKey
Digital Certificates
Digital Signatures
DH Key Exchange
DSA
Email
Email Object
FTP
HTML-to-XML
HTTP
IMAP
Encryption
MHT / HTML Email
NTLM
POP3
RSA
S/MIME
SMTP
Socket
Spider
SFTP
SSH
SSH Key
SSH Tunnel
String
Tar
Upload
XML
XMP
Zip Compression

More Examples...
Byte Array
FileAccess
RSS
Atom
Self-Extractor
Service
PPMD
Deflate
Bzip2
LZW

Type Conversion

 

Article: Understanding COM References in Delphi

AES String Encryption

AES string encryption in Delphi.

Download Chilkat Crypt ActiveX

uses
    Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
    Dialogs, StdCtrls,
    CHILKATCRYPT2Lib_TLB,
    OleCtrls;

...

procedure TForm1.Button1Click(Sender: TObject);
var
crypt: TChilkatCrypt2;
success: Integer;
password: String;
hexKey: String;
text: String;
encText: String;
decryptedText: String;

begin
crypt := TChilkatCrypt2.Create(Self);

success := crypt.UnlockComponent('Anything for 30-day trial');
if (success <> 1) then
  begin
    ShowMessage('Crypt component unlock failed');
    Exit;
  end;

password := 'secretPassPhrase';

crypt.CryptAlgorithm := 'aes';
crypt.CipherMode := 'cbc';
crypt.KeyLength := 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 := crypt.GenEncodedSecretKey(password,'hex');
crypt.SetEncodedKey(hexKey,'hex');

crypt.EncodingMode := '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 := crypt.EncryptStringENC(text);

Memo1.Lines.Add(encText);

//  Decrypt and show the original string:
decryptedText := crypt.DecryptStringENC(encText);

Memo1.Lines.Add(decryptedText);
end;

 

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

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

Mail Component · .NET Email Component · XML Parser