Here are is an example for Delphi that demonstrates encryption from memory to file 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; 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';
xEnc.WriteFile( vaSource, efpEncrypt, true, 'c:\temp\encrypted.aes', false );
ShowMessage( 'Encryption successful!' );
except on xErr : Exception do ShowMessage( xErr.Message ); end;
xEnc.Free; end; |