InstantDB      Basic Topics      Advanced Topics      Reference Topics
Documentation Home Page

Data Encryption

Some Warnings
Links to Java™ Crypto Providers

InstantDB allows you to add your own data encryption modules. This must implement the interface org.enhydra.instantdb.db.TableEncrypt:

class MyCipher implements db.TableEncrypt {
    void Encrypt(String tableName, byte rowBuffer[], int rowNumber, int colOffsets[]) {
            ...
        }
        void Decrypt(String tableName, byte
            rowBuffer[], int rowNumber, int
            colOffsets[]) {
        ...
    }
}

Once you have written an encryption module, it must be associated with a table using the InstantDB JDBC™ call:

MyCipher cipher = new MyCipher ();
idbConnection con = (idbConnection)DriverManager.getConnection (url);
con.setTableEncryption ("MyEncryptedTable", con);

In the above example, InstantDB will associated the cipher object with the table MyEncryptedTable. Every time a row from MyEncryptedTable is written or read from disk, the cipher.encrypt() and cipher.decrypt() methods will be invoked.

A simple implementation of db.TableEncrypt is given in RowEncrypt.java in the Examples directory. The file EncryptTest.java shows this example module being used. Change to the Examples directory and issue the command:

java EncryptTest

Comparing the files tables/clear.tbl and tables/encrypted.tbl in a binary editor should illustrate the difference between the data contents.

Some Warnings

The RowEncrypt example module is only an example of how to implement the org.enhydra.instantdb.db.TableEncrypt interface. It uses a deliberately weak algorithm. Sensitive data should not be encrypted used the example module.

Do not create indexes on encrypted columns. Indexes, by their very nature, are based on the unencrypted values of the data.

Use and distribution of encryption software is restricted, or even banned in many countries. Make sure you are aware of any local regulations before you use encryption software.

Links to Java™ Crypto Providers

InstantDB does not come with any Java™ Cryptography Package Providers. However, there are several excellent Java™ implementations available. Any one of the packages below will provide all of the popular ciphers, digests and signature algorithms in use today.


Copyright © 2000 Lutris Technologies. All rights reserved.