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 db.TableEncrypt
interface. It uses a deliberately weak algorithm. Sensistive 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™ implementation
available. Any one of the packages below will provide all of the
popular ciphers, digests and signature algorithms in use today.
- eSec
Open JCE - A commercial implementation recently made Open
Source.
- Baltimore
A commercial JCE™ from the much respected Baltimore team.
- Cryptix
The Java™ community's very own collective implementation.
- IAIK
University of Graz implemenation. Very comprehensive.
- logi.crypto
(formerly cryptonite).
|