xl2.odb
Class EncryptedDatabase
java.lang.Object
|
+--xl2.odb.XL2Database
|
+--xl2.odb.EncryptedDatabase
- public class EncryptedDatabase
- extends XL2Database
Encypts serialized objects using Password Based Encryption with MD5 and
DES. Uses the Java Cryptography Extension.
Be sure to set database password #setPassword(String) before opening a
database.
The JCE must be
installed in the runtime environment.
Method Summary |
java.io.ObjectInput |
getObjectInput(java.io.InputStream in)
Returns an ObjectInputStream nesting a CipherInputStream. |
java.io.ObjectOutput |
getObjectOutput(java.io.OutputStream out)
Returns an ObjectOutputStream nesting a CipherOutputStream. |
void |
newDatabase(java.lang.String dbDir)
Will throw an exception, use newDatabase(String,String) |
void |
newDatabase(java.lang.String dbDir,
java.lang.String password)
Creates an EncryptedDatabase that will be closed upon
completion of this method. |
void |
open(java.lang.String dbDir,
int mode)
Password must have be set before calling this:
Opens the database with the given mode. |
void |
setPassword(java.lang.String password)
Must be called before opening a database. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
EncryptedDatabase
public EncryptedDatabase()
getObjectInput
public java.io.ObjectInput getObjectInput(java.io.InputStream in)
throws XL2Exception
- Returns an ObjectInputStream nesting a CipherInputStream.
- Overrides:
getObjectInput
in class XL2Database
- Throws:
XL2Exception
- Wrapping any exceptions from the crypto lib.
getObjectOutput
public java.io.ObjectOutput getObjectOutput(java.io.OutputStream out)
throws XL2Exception
- Returns an ObjectOutputStream nesting a CipherOutputStream.
- Overrides:
getObjectOutput
in class XL2Database
- Throws:
XL2Exception
- Wrapping any exceptions from the crypto lib.
newDatabase
public void newDatabase(java.lang.String dbDir)
throws XL2Exception
- Will throw an exception, use newDatabase(String,String)
- Overrides:
newDatabase
in class XL2Database
- Following copied from class:
xl2.odb.XL2Database
- Parameters:
dbDir
- XL2Database directory.- Throws:
XL2Exception
- Wrapping any other exceptions.
newDatabase
public void newDatabase(java.lang.String dbDir,
java.lang.String password)
throws XL2Exception
- Creates an EncryptedDatabase that will be closed upon
completion of this method.
- Parameters:
dbDir
- XL2Database directory.password
- Key for encrypting/decrypting data.- Throws:
XL2Exception
- Wrapping any internal exception such as an
IOException.
open
public void open(java.lang.String dbDir,
int mode)
throws DatabaseLockedException,
XL2Exception
- Password must have be set before calling this:
Opens the database with the given mode.
- Overrides:
open
in class XL2Database
- Parameters:
dbDir
- The database directory.mode
- OPEN_READ_ONLY or OPEN_READ_WRITE- Throws:
DatabaseLockedException
- If a lock file prevents opening.XL2Exception
- Wrapping any exceptions.
setPassword
public void setPassword(java.lang.String password)
throws XL2Exception
- Must be called before opening a database.
- Throws:
XL2Exception
- Wrapping any exceptions.