Xceed Encryption Library Documentation
Encrypting and decrypting entirely in memory (Delphi example)
Examples > Encrypting and decrypting entirely in memory (Delphi example)

Here are is an example for Delphi that demonstrates encryption entirely in memory in a single pass. It shows how to use the Rijndael algorithm.

Delphi Copy Code

uses XceedEncryptionLib_TLB 

var  xEnc : TXceedEncryption; 
  xRijndael : DXceedRijndaelEncryptionMethod; 
  vaSource : OleVariant; 
  vaDest : OleVariant; 
begin
  xEnc := TXceedEncryption.Create( self ); 
  xEnc.License( 'your license key' ); 

  xRijndael := CoXceedRijndaelEncryptionMethod.Create();  

  try 
    xRijndael.SetSecretKeyFromPassPhrase( 'This is a weak pass phrase!', 128 ); 
    xEnc. EncryptionMethod := xRijndael; 

    vaSource := 'This is the data to encrypt'; 
    vaDest := xEnc.Encrypt( vaSource, true ); 

    ShowMessage( 'Encryption successful!' ); 
  except 
    on xErr : Exception do 
      ShowMessage( xErr.Message ); 
  end;  

  xEnc.Free; 
end;