Simple encryption and decryption Professional
Xbase++ provides a set of classes to manage encryption for many kind of data, be it a simple character string, or a complete file. The classes reflect several roles used in encryption:
Role | Xbase++ class | method |
---|---|---|
Key generator | SecureKey() | generate() |
Key provider | SecureKey() | |
Crypto provider | AesCrypt() | |
Crypto user | CryptFile() CryptTable() |
To encrypt a string, for example, you need to provide a key. A key can be generated by calling SecureKey():generate(), or manually supplied either in binary form or hexadecimal notation. After the key is setup, an instance of AesCrypt() is required to prepare for encryption and/or decryption. Both directions are possible, but the application must know about the encryption status of the data. The key object passed to AesCrypt():new() is not stored inside of this instance. For security reasons, The method oSecureKey:destroy() should be called right after supplying the key. Assigning NIL to a variable holding an instance of SecureKey() won't destroy the key immediately.
The CryptFile() class provides encryption/decryption at the level of files. Please refer to CryptFile() for details.
If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.