sos.koa
Class DecryptAdapter
java.lang.Object
sos.koa.Task
sos.koa.DecryptAdapter
- All Implemented Interfaces:
- java.awt.event.ActionListener, java.util.EventListener, KOAConstants
- public class DecryptAdapter
- extends Task
Class to decrypt the votes.
- Version:
- $Id: DecryptAdapter.java,v 1.45 2004/05/25 12:15:41 hubbers Exp $
- Author:
- Martijn Oostdijk (martijno@cs.kun.nl)
Specifications inherited from class Task |
invariant 0 <= subTaskCount&&subTaskCount <= maxSubTasks; |
Field Summary |
(package private) static java.lang.String |
DESEDE_DECRYPT_ALGORITHM
The algorithm used by the desedeCipher. |
[spec_public] (package private) javax.crypto.Cipher |
desedeCipher
The session key cipher for decrypting the vote information. |
[spec_public] (package private) java.util.ArrayList |
errors
A list containing errors encountered this far. |
[spec_public] (package private) boolean |
keepRunning
Indicates whether to keep decrypting. |
[spec_public] (package private) int |
rowCount
The number of votes decrypted this far. |
(package private) static java.lang.String |
RSA_ALGORITHM
The algorithm used by the rsaCipher . |
[spec_public] (package private) javax.crypto.Cipher |
rsaCipher
The RSA cipher for decrypting the session key. |
private static byte[] |
SALT
The salt value used to generate the session keys. |
Fields inherited from interface sos.koa.KOAConstants |
ADDITIONAL_INFO_EXTRA, ADDITIONAL_INFO_MAX_HEIGHT, ADDITIONAL_INFO_MAX_WIDTH, AUDITLOG, AUDITLOG_PDF, AUDITLOG_XML, AUDITLOG_XSL, BASEDIR, CANDIDATES_IMPORTED_STATE, CLEAR_BUT_TXT, CLEAR_FAILURE_MSG, CLEAR_SUCCESS_MSG, CLEAR_TASK_MSG, CLEAR_WARNING_MSG, CLEAR_WARNING_MSG_1, CLEAR_WARNING_MSG_2, CLEARED_STATE, COUNT_BUT_TXT, COUNT_FAILURE_MSG, COUNT_SUCCESS_MSG, COUNT_TASK_MSG, COUNT_WARNING_MSG, DECRYPT_BUT_TXT, DECRYPT_ERROR_MSG, DECRYPT_ERROR_TAG, DECRYPT_FAILURE_MSG, DECRYPT_SUCCESS_MSG, DECRYPT_TASK_MSG, DECRYPT_WARNING_MSG, DECRYPTEDFILE, DEFAULT_VOTING_INTERVAL, EXIT_BUT_TXT, EXIT_FAILURE_MSG, EXIT_SUCCESS_MSG, EXIT_TASK_MSG, EXIT_WARNING_MSG, FORWARD_BACK_OPTIONS, FORWARD_MOREINFO_BACK_OPTIONS, HELP_BUT_TXT, HELP_TASK_MSG, IMPORT_CANDIDATES_BUT_TXT, IMPORT_CANDIDATES_FAILURE_MSG, IMPORT_CANDIDATES_SUCCESS_MSG, IMPORT_CANDIDATES_TASK_MSG, IMPORT_CANDIDATES_WARNING_MSG, IMPORT_KEY_FAILURE_MSG, IMPORT_KEY_SUCCESS_MSG, IMPORT_KEY_WARNING_MSG, IMPORT_PRIVATE_KEY_BUT_TXT, IMPORT_PRIVATE_KEY_TASK_MSG, IMPORT_PUBLIC_KEY_BUT_TXT, IMPORT_PUBLIC_KEY_TASK_MSG, IMPORT_VOTES_BUT_TXT, IMPORT_VOTES_FAILURE_MSG, IMPORT_VOTES_SUCCESS_MSG, IMPORT_VOTES_TASK_MSG, IMPORT_VOTES_WARNING_MSG, INIT_STATE, LESSINFO_OPTION, MAX_ENCRYPTED_VOTE_LENGTH, MAX_KEY_LENGTH, MOREINFO_OPTION, NO_ERRORS_MSG, NUMBER_OF_REDUNDANT_FIELDS, OK_CANCEL_OPTIONS, OK_LESSINFO_CANCEL_OPTIONS, OK_LESSINFO_OPTIONS, OK_MOREINFO_CANCEL_OPTIONS, OK_MOREINFO_OPTIONS, OK_OPTIONS, OUTDIR, PRIVATE_KEY_IMPORTED_STATE, PRIVATE_KEYTYPE, PUBLIC_KEY_IMPORTED_STATE, PUBLIC_KEYTYPE, RECOUNT, RECOUNT_PDF, RECOUNT_XML, RECOUNT_XSL, RELEASE, REPORT_BUT_TXT, REPORT_FAILURE_MSG, REPORT_GENERATED_STATE, REPORT_OPTIONS, REPORT_SUCCESS_MSG, REPORT_TASK_MSG, REPORT_WARNING_MSG, RESTART_BUT_TXT, RESTART_FAILURE_MSG, RESTART_SUCCESS_MSG, RESTART_TASK_MSG, RESTART_WARNING_MSG, TASK_CANCELED_MSG, TITLE, VOTES_COUNTED_STATE, VOTES_DECRYPTED_STATE, VOTES_IGNORED_SEE_MORE_INFO_MSG, VOTES_IMPORTED_STATE, YES_CANCEL_OPTIONS, YES_NO_OPTIONS |
Method Summary |
private java.lang.String |
decrypt(byte[] encryptedVote)
Decrypts one vote. |
(package private) void |
doAction()
Decrypts the votes in rawVotes . |
(package private) java.lang.Object |
getAdditionalInfo()
Gets even more information about this (completed) task. |
(package private) java.lang.String[] |
getErrors()
Gets the errors encountered during execution of this task. |
(package private) java.lang.String |
getFailureMessage()
|
(package private) java.lang.String |
getInfo()
Gets information that should be displayed if this task completes
successfully. |
(package private) java.lang.String |
getSuccessMessage()
|
(package private) int |
getSuccessState()
|
(package private) java.lang.String |
getTitle()
|
(package private) boolean |
isAdditionalInfoAvailable()
Indicates whether even more information is available about this
(completed) task. |
(package private) boolean |
isPreStateAllowed(int state)
|
boolean |
isProgressMonitoredTask()
Indicates whether a progress monitor should be popped up. |
(package private) void |
logCompleted()
Writes a 'task completed' entry in the log. |
(package private) void |
logFailed(java.lang.String reason)
Writes a 'task failed' entry in the log. |
(package private) void |
logStarted()
Writes a 'task started' entry in the log. |
(package private) void |
stopAction()
Interrupts the execution of doAction . |
Methods inherited from class sos.koa.Task |
actionPerformed, clear, getWarningMessage, isCancelableTask, isDangerousTask, isModalTask, logCanceled, logOpenedFile, popupAdditionalInfo, popupAdditionalInfo, popupFailure, popupGetFile, popupGetPassword, popupNext, popupNextOrBack, popupSuccess, popupWarning, setMaxSubTasks, setSubTaskCount |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SALT
private static final byte[] SALT
- The salt value used to generate the session keys.
RSA_ALGORITHM
static final java.lang.String RSA_ALGORITHM
- The algorithm used by the
rsaCipher
.
DESEDE_DECRYPT_ALGORITHM
static final java.lang.String DESEDE_DECRYPT_ALGORITHM
- The algorithm used by the desedeCipher.
rsaCipher
javax.crypto.Cipher rsaCipher
- The RSA cipher for decrypting the session key.
- Specifications: spec_public
desedeCipher
javax.crypto.Cipher desedeCipher
- The session key cipher for decrypting the vote information.
- Specifications: spec_public
keepRunning
boolean keepRunning
- Indicates whether to keep decrypting.
- Specifications: spec_public
rowCount
int rowCount
- The number of votes decrypted this far.
- Specifications: spec_public
errors
java.util.ArrayList errors
- A list containing errors encountered this far.
- Specifications: spec_public
DecryptAdapter
public DecryptAdapter()
- Constructs this adapter.
getTitle
java.lang.String getTitle()
- Description copied from class:
Task
- The title of this task. Is used in title-bar of dialogs.
- Specifications: pure non_null
- Specifications inherited from overridden method in class Task:
pure
getSuccessMessage
java.lang.String getSuccessMessage()
- Description copied from class:
Task
- What to print in success dialog.
- Specifications: pure non_null
- Specifications inherited from overridden method in class Task:
pure
getFailureMessage
java.lang.String getFailureMessage()
- Description copied from class:
Task
- What to print in failure dialog.
- Specifications: pure non_null
- Specifications inherited from overridden method in class Task:
pure
getInfo
java.lang.String getInfo()
- Description copied from class:
Task
- Gets information that should be displayed if this task completes
successfully.
- Overrides:
getInfo
in class Task
- Specifications: pure non_null
- Specifications inherited from overridden method in class Task:
-
assignable AuditLog.*;
isPreStateAllowed
boolean isPreStateAllowed(int state)
- Specifications: pure
- Specifications inherited from overridden method in class Task:
pure
getSuccessState
int getSuccessState()
- Description copied from class:
Task
- The application state after successful termination
of this task.
- Specifications: pure
- Specifications inherited from overridden method in class Task:
pure
isProgressMonitoredTask
public boolean isProgressMonitoredTask()
- Description copied from class:
Task
- Indicates whether a progress monitor should be popped up. Default is
false.
- Overrides:
isProgressMonitoredTask
in class Task
- Specifications: pure
- Specifications inherited from overridden method in class Task:
pure
logStarted
void logStarted()
- Description copied from class:
Task
- Writes a 'task started' entry in the log.
- Overrides:
logStarted
in class Task
- Specifications:
- also
-
behavior
assignable AuditLog.*;
- Specifications inherited from overridden method in class Task:
-
assignable AuditLog.*;
logFailed
void logFailed(java.lang.String reason)
- Description copied from class:
Task
- Writes a 'task failed' entry in the log.
- Overrides:
logFailed
in class Task
- Specifications:
- also
-
behavior
requires reason != null;
assignable AuditLog.*;
- Specifications inherited from overridden method logFailed(String reason) in class Task:
-
assignable AuditLog.*;
logCompleted
void logCompleted()
- Description copied from class:
Task
- Writes a 'task completed' entry in the log.
- Overrides:
logCompleted
in class Task
- Specifications:
- also
-
behavior
assignable AuditLog.*;
- Specifications inherited from overridden method in class Task:
--- None ---
doAction
void doAction()
throws KOAException
- Decrypts the votes in
rawVotes
.
- Throws:
KOAException
- if decryption failed.
- Specifications:
- also
-
behavior
requires MenuPanel.getTheMenuPanel().rawVotes != null;
assignable \everything;
ensures MenuPanel.getTheMenuPanel().rawVotes != null;
- Specifications inherited from overridden method in class Task:
-
assignable objectState;
stopAction
void stopAction()
- Interrupts the execution of
doAction
.
- Overrides:
stopAction
in class Task
- Specifications inherited from overridden method in class Task:
--- None ---
decrypt
private java.lang.String decrypt(byte[] encryptedVote)
throws KOAException
- Decrypts one vote.
- Parameters:
encryptedVote
- the vote to decrypt.
- Returns:
- the decrypted vote.
- Throws:
KOAException
- if decryption failed.
- Specifications: non_null
-
private behavior
requires encryptedVote != null;
assignable rsaCipher.*, desedeCipher.*;
signals (KOAException) true;
getAdditionalInfo
java.lang.Object getAdditionalInfo()
- Description copied from class:
Task
- Gets even more information about this (completed) task. The resulting
Object
can be used in a dialog message.
- Overrides:
getAdditionalInfo
in class Task
- Specifications: pure non_null
- Specifications inherited from overridden method in class Task:
pure
isAdditionalInfoAvailable
boolean isAdditionalInfoAvailable()
- Description copied from class:
Task
- Indicates whether even more information is available about this
(completed) task.
- Overrides:
isAdditionalInfoAvailable
in class Task
- Specifications: pure
- Specifications inherited from overridden method in class Task:
pure
getErrors
java.lang.String[] getErrors()
- Gets the errors encountered during execution of this task.
- Returns:
- an array of error strings.
- Specifications: pure non_null