EncryptAES Function

Action

Encrypts string or binary data into a printable format using the Advanced Encryption Standard (AES) block cipher. This function is useful for encrypting passwords and other sensitive data.

Include file

kernel.bdh

Syntax

EncryptAES( in sData : string,
             in sKey : string optional ): string;

Return value

  • encrypted string

Parameter Description
sData String or binary data to be encrypted
sKey String or binary data used as encryption key (optional).

Example

dcltrans
  transaction TMain
  var
    sUserPass  : string;
    sEncrypted : string;
  begin
    // Build your own authentication header
    AttributeGetString("Password", sUserPass);
    sEncrypted := EncryptAES(sUserPass);
    Print(sEncrypted);
    sUserPass := DecryptAES(sEncrypted);
    Print("decrypted password: " + sUserPass);
  end TMain;