Encryption and decryption of databases Professional
Xbase++ integrates encryption of data also into it's DatabaseEngines. Currently, only tables managed by the FOXDBE can be encrypted. To use encryption for a table, a key will be required again, and a crypto provider. The CryptTable()class manages the configuration of the DBE, using the supplied crypto provider instance (ie. of AesCrypt()).
A database is encrypted by openening the source table, setting up the structure for the target table by calling oCryptTable:setupStruct(), and enabling encryption for the target table by calling oCryptTable:enable(). Now, the records of the source table can be appended to the target table. If an index is used, it must be created after enabling encryption.
If creating an encrypted table the method <oCryptTable:setupStruct()> is essential. This is because most encryption provider require a specific records size. In the context of the AES encryption provider the block size is 16 bytes leading to the fact that record-sizes have to be a multiple.of 16 bytes. The <oCryptTable:setupStruct()> is automatically adding a __FILL field to the table structure to ensure that recsize matches this rule. In addition a special __IV - initialization vector - field is added as the first field in the table. By default the crypt provider fills that __IV with random data to increase the level of security.
If an encrypted table is used without enabling encryption (ie. supplying the key, essentially), garbled output will be read and can lead to runtime errors, for example when reading memo fields. Writing will lead to unrecoverable data loss, because even after the key is supplied the decryption will return senseless data.
Notes for this release:
The current implementation of table encryption does not encrypt header information, and the only possible operation mode is CRYPT_OP_CTS.
The FOXDBE.DLL comes as a replacement DLL. Please make a backup copy of the original FOXDBE.DLL.
Fields of type Memo are not yet encrypted.
AesCrypt() uses one block size of 16 byte.
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.