All Packages  Class Hierarchy  This Package  Previous  Next  Index

Interface db.TableEncrypt

public interface TableEncrypt
Allows database developers to encrypt InstantDB data.

Developers create an encryption class which implements this interface. InstantDB associates a TableEncrypt object with a Table. When reading or writing to disk, InstantDB invokes the associated methods on the TableEncrypt object to encrypt or decrypt each row of the table.

A TableEncrypt object is associated with a table using the method: jdbc.idbConnection.setTableEncryption (String tableName, TableEncrypt encrypter).

Indexes are created using the clear text values of columns. Therefore, you should not create indexes on columns which you wish to remain confidential.


Method Index

 o Decrypt(String, byte[], int, int[])
Invoked by InstantDB just after a row is has been read from disk.
 o Encrypt(String, byte[], int, int[])
Invoked by InstantDB just before a row is about to be written to disk.

Methods

 o Encrypt
 public abstract void Encrypt(String tableName,
                              byte rowBuffer[],
                              int rowNumber,
                              int colOffsets[])
Invoked by InstantDB just before a row is about to be written to disk.

Parameters:
tableName - The name of the table being encrypted. A single TableEncrypt object can be associated with multiple tables. This parameter allows the implementation to vary the encryption process for each table.

rowBuffer - The actual row of data to be encrypted. The encryption algorithm must guarantee that the data does not increase in size as a result of the encryption process. On return from this method, rowBuffer should contain encrypted data.

Room for cipher padding can be achieved by creating dummy CHAR columns of sufficient size either after individually encrypted columns, or by including a single dummy CHAR column at the end of a row if the whole row is to be encrypted.

rowNumber - This parameter allows implementations to vary their encryption algorithm depending on the physical row number in the table.

colOffsets - An array specifying the offsets of each column in rowBuffer. This allows applications to encrypt individual columns and so increase the speed of the encryption process.

The control column: $$control, which is present in every InstantDB table is included in both rowBuffer and in colOffsets. InstantDB ensures that this column is NOT encrypted on disk.

 o Decrypt
 public abstract void Decrypt(String tableName,
                              byte rowBuffer[],
                              int rowNumber,
                              int colOffsets[])
Invoked by InstantDB just after a row is has been read from disk.

Parameters:
tableName - The name of the table being encrypted. A single TableEncrypt object can be associated with multiple tables. This parameter allows the implementation to vary the decryption process for each table.

rowBuffer - The actual row of data to be decrypted. On return from this method, rowBuffer should contain decrypted data.

rowNumber - This parameter allows implementations to vary their decryption algorithm depending on the physical row number in the table.

colOffsets - An array specifying the offsets of each column in rowBuffer. The control column: $$control, which is present in every InstantDB table is included in both the rowBuffer and colOffsets.

All Packages  Class Hierarchy  This Package  Previous  Next  Index