close×
Steema Documentation / TeeBI VCL/FMX / Tutorials

Encryption

Encryption

Sensible configuration data in TeeBI like passwords can be optionally encrypted using a small class and a "plugin" encryption engine.

To setup an engine you need to specify your desired "secret key" (an string) and a class that provides encryption and decryption.

There is currently one plugin available using "Turbopower's LockBox", available free from IDE Tools-> GetIt package manager, or at:

https://github.com/TurboPack

The code to use LockBox:

uses BI.UI, BI.Crypt.LockBox;
TBILockBox.Cipher:= TBICipher.Blowfish;
TBILockBox.SetKey('this is the secret key');
TCrypto.Engine:= TBILockBox;

Data that is currently encrypted are strings in the *.def files inside a store folder (see TDataDefinition class), for passwords used to connect to a database server and passwords for optional connections to a BIWeb server using an http proxy.

For custom encryption, the TCrypto class provides methods to encrypt/decrypt a String or a TStream.

Example of String:

var Encrypted, Decrypted : String;
Encrypted:= TCrypto.Encrypt('Hello');
Decrypted:= TCrypto.Decrypt(Encrypted);