SafeJDBC v2.00

com.safejdbc.api
Class ColumnsCipher

java.lang.Object
  extended by com.safejdbc.api.ColumnsCipher

public final class ColumnsCipher
extends Object

API to update the SafeJdbc Catalog using a list of tables and columns to cipher, i.e. to encrypt or decrypt.
Class also updates the application columns with the cipher values.


Field Summary
static int DECRYPT_MODE
          The mode for sql data decryption
static int ENCRYPT_MODE
          The mode for sql data encryption
 
Constructor Summary
protected ColumnsCipher(Connection connection)
          Constructor.
 
Method Summary
 void addColumn(String sTableColumn)
          Adds a column to the list of Sql columns to be encrypted/decrypted using the "table.column" syntax.
 void addColumn(String sTable, String sColumn)
          Adds a column to the list of Sql columns to be encrypted/decrypted.
 void addColumnsfromFile(String sCipherColumnsIni)
          Adds columns using values stored in an ini file.
 void defineJoinColumn(String sTableJoinColumn, String sTableReferenceColumn)
          Defines a Column as a Join Column with a Reference Column, using the "table.column" syntax.
 void defineJoinColumn(String sTableJoin, String sJoinColumn, String sTableReference, String sReferenceColumn)
          Defines a Column as a Join Column with a Reference Column.
 void defineJoinColumnsfromFile(String sCipherColumnsIni)
          Defines Join columns using values in a ini file

The ini filename must not contain any path info.
 void execute(int nMode)
          Executes the update of the SafeJDBC Sql Store and executes the SQL UPDATE commands for each column to be encrypted or decrypted as specified with the addColumn method.
static ColumnsCipher getInstance(Connection connection)
          Returns a new ColumnsCipher instance.
 void setFileOutputStream(String sFile)
          Sets the name of the output file for displaying results.
 void setOutputStream(OutputStream os)
          Sets the name of the output stream for displaying results.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ENCRYPT_MODE

public static final int ENCRYPT_MODE
The mode for sql data encryption

See Also:
Constant Field Values

DECRYPT_MODE

public static final int DECRYPT_MODE
The mode for sql data decryption

See Also:
Constant Field Values
Constructor Detail

ColumnsCipher

protected ColumnsCipher(Connection connection)
                 throws SQLException
Constructor.

Parameters:
connection - the SafeJDBC Connection
Throws:
SQLException - if the connection is not a SafeJDBC Connection i.e. an instance of CipherConnection class.
Method Detail

getInstance

public static ColumnsCipher getInstance(Connection connection)
                                 throws SQLException
Returns a new ColumnsCipher instance.

Parameters:
connection - the SafeJDBC Connection
Throws:
SQLException - if the connection is not a SafeJDBC Connection i.e. an instance of CipherConnection class.

setOutputStream

public void setOutputStream(OutputStream os)
Sets the name of the output stream for displaying results.

Parameters:
os - the output stream

setFileOutputStream

public void setFileOutputStream(String sFile)
                         throws IOException
Sets the name of the output file for displaying results.

Parameters:
sFile - the output file
Throws:
IOException - if an I/O error occurs

addColumn

public void addColumn(String sTableColumn)
Adds a column to the list of Sql columns to be encrypted/decrypted using the "table.column" syntax.

Parameters:
sTableColumn - the SQL column name with a dot, as in "table.column"

addColumn

public void addColumn(String sTable,
                      String sColumn)
Adds a column to the list of Sql columns to be encrypted/decrypted.

Parameters:
sTable - the SQL table name
sColumn - the SQL column name

defineJoinColumn

public void defineJoinColumn(String sTableJoinColumn,
                             String sTableReferenceColumn)
                      throws SQLException
Defines a Column as a Join Column with a Reference Column, using the "table.column" syntax.
The following rules apply:

Parameters:
sTableJoinColumn - the SQL Join column name with a dot, as in "table.column"
sTableReferenceColumn - the SQL Reference column name with a dot, as in "table.column"
Throws:
SQLException - if a table or column name is not a Cipher Column

defineJoinColumn

public void defineJoinColumn(String sTableJoin,
                             String sJoinColumn,
                             String sTableReference,
                             String sReferenceColumn)
                      throws SQLException
Defines a Column as a Join Column with a Reference Column.
The following rules apply:

Parameters:
sTableJoin - the table of the Join column
sJoinColumn - the SQL Join column
sTableReference - the table of the Reference column
sReferenceColumn - the SQL Reference column
Throws:
SQLException - if a table or column name is not a Cipher Column

execute

public void execute(int nMode)
             throws SQLException
Executes the update of the SafeJDBC Sql Store and executes the SQL UPDATE commands for each column to be encrypted or decrypted as specified with the addColumn method.
All commands are issued in a transaction.

Parameters:
nMode - the operating mode of this ColumnsCipher:
Throws:
SQLException - if a SQL error occurs during processing.

addColumnsfromFile

public void addColumnsfromFile(String sCipherColumnsIni)
                        throws FileNotFoundException,
                               IOException
Adds columns using values stored in an ini file.

The ini filename must not contain any path info. The real name with path info is found in the Java CLASSPATH.

The ini file must contain the full column names using the "table.column" syntax.

Parameters:
sCipherColumnsIni - The ini file containing columns to cipher, with path info.
Throws:
FileNotFoundException - if the file is not found in the classpath
IOException - if an I/O error occurs

defineJoinColumnsfromFile

public void defineJoinColumnsfromFile(String sCipherColumnsIni)
                               throws FileNotFoundException,
                                      IOException,
                                      SQLException
Defines Join columns using values in a ini file

The ini filename must not contain any path info. The real name with path info is found in the Java CLASSPATH.

The ini file must contain the full column names using the "table.column" syntax.

Parameters:
sCipherColumnsIni - The ini file containing join columns & reference columns, with path info.
Throws:
FileNotFoundException - if the file is not found in the classpath
IOException - if an I/O error occurs
SQLException - if a table or column name is not a Cipher Column

SafeJDBC v2.00

Copyright © SafeLogic 2011