|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--Free.DBase
DBase creates databases, tables and interacts with these through JDBC and SQL. Implementation of the databases is with Hypersonic SQL which is written totally in Java. The logic for calculating totals is also performed in this class.
Field Summary | |
protected static java.lang.String |
cryptword
|
Constructor Summary | |
DBase()
|
Method Summary | |
protected static int |
authKeyCheck(java.lang.String key2)
This method retrieves stored AuthKeys (encrypted with secret key 1)
decrypts them and then compares with the decrypted AuthKey delivered with
the vote (originally encrypted with secret key 2). |
protected static void |
calcResult()
analyses the totals to create the final results for the vote. |
protected static java.lang.String |
decrypt(java.lang.String data)
Decrypts data pulled from the database returning normal strings. |
protected static void |
doSQL(java.lang.String sqlCommand)
executes the SQL command sent as a parameter and returns the result to DB Console. |
protected static java.util.Vector |
getTotals()
analyses votes to create data for total packets. |
protected static void |
importKeys()
Imports keys from the ERServer , decrypts them and then inserts them into
AuthKeys table. |
protected static void |
init()
initialises the Hypersonic SQL database. |
protected static boolean |
isSafe(java.lang.String input)
checks String input to make sure it only contains safe characters. |
protected static boolean |
removeKey(java.lang.String akey)
Removes key from database once used for security + vote confirmation |
protected static void |
storeTotal(java.lang.String choice,
java.lang.String total)
adds a total entry to the database. |
protected static void |
storeVote(java.lang.String data)
adds a vote entry to the database. |
protected static void |
verCheck(int ERtotal)
Checks the number of votes registered against what ERServer reported. |
Methods inherited from class java.lang.Object |
|
Field Detail |
protected static java.lang.String cryptword
Constructor Detail |
public DBase()
Method Detail |
protected static void init()
protected static java.lang.String decrypt(java.lang.String data) throws java.lang.Exception
data
- The encrypted stringprotected static boolean isSafe(java.lang.String input) throws java.lang.Exception
input
- The String to checkprotected static void storeVote(java.lang.String data) throws java.lang.Exception
data
- The string representing the party to insertprotected static void storeTotal(java.lang.String choice, java.lang.String total) throws java.lang.Exception
data
- The string representing the total data to inserprotected static void calcResult() throws java.lang.Exception
protected static java.util.Vector getTotals() throws java.lang.Exception
protected static boolean removeKey(java.lang.String akey)
akey
- The key to removeprotected static int authKeyCheck(java.lang.String key2) throws java.lang.Exception
AuthKeys
(encrypted with secret key 1)
decrypts them and then compares with the decrypted AuthKey
delivered with
the vote (originally encrypted with secret key 2).
If a match is found then the AuthKey encrypted with secret key 1 is sent to the
ERServer. On confirmation it is removed from the database here.
This impacts performance - it could have been simply done as a SELECT statement if the
keys weren't stored encrypted, however I feel this is a necessary security precaution
especially when the security of the database is not known in our db independent setup.
Note that since 1.5 all db data is encrypted. Thus keys are twice encrypted.data
- The string representing the party to insertprotected static void importKeys() throws java.lang.Exception
ERServer
, decrypts them and then inserts them into
AuthKeys
table.protected static void verCheck(int ERtotal) throws java.lang.Exception
ERtotal
- What the ERServer returnedprotected static void doSQL(java.lang.String sqlCommand)
sqlCommand
- A string containing SQL
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |