SHATransaction
super class contains the bare minimum functionality necessary for the steps involved in most SHA transaction applications.
The first characteristic of a SHA Transaction is that it is tied to an immutable SHAiButtonCopr
, used for data signing and recreating user authentication responses. The SHA Transaction guarantees an interface for initializing account transaction data (setupTransactionData
), verifying that the transaction data has not been tampered with (verifyTransactionData
), performing the transaction and updating the data (executeTransaction
), and validating a user with a challenge-response authentication protocol (verifyUser
).
In addition, all transactions are characterized by certain parameters (i.e. how much to debit from the user or what level of access is being requested from the system). The interface for retrieving and setting these parameters is provided through the generic getParameter
and setParameter
.
Public Member Functions | |
int | getLastError () |
int | getLastCoprError () |
abstract boolean | setupTransactionData (SHAiButtonUser user) throws OneWireException, OneWireIOException |
abstract boolean | verifyUser (SHAiButtonUser user) throws OneWireException, OneWireIOException |
abstract boolean | verifyTransactionData (SHAiButtonUser user) throws OneWireException, OneWireIOException |
abstract boolean | executeTransaction (SHAiButtonUser user, boolean verifySuccess) throws OneWireException, OneWireIOException |
abstract boolean | setParameter (int type, int param) |
abstract int | getParameter (int type) |
abstract void | resetParameters () |
Protected Member Functions | |
SHATransaction () | |
SHATransaction (SHAiButtonCopr copr) | |
Protected Attributes | |
int | lastError |
The last error that occurred during this transaction. | |
SHAiButtonCopr | copr |
The coprocessor used to complete this transaction. | |
Static Package Attributes | |
static final boolean | DEBUG = false |
Turns on extra debugging for all SHATransactions. |
SHATransaction | ( | ) | [protected] |
User applications should not instantiate this class without an instance of a coprocessor.
SHATransaction | ( | SHAiButtonCopr | copr | ) | [protected] |
Creates a new SHATransaction, ensuring that reference to the coprocessor is saved and the errors are cleared.
int getLastError | ( | ) |
Returns the error code for the last error in the transaction process.
int getLastCoprError | ( | ) |
Returns the error code for the last error in the transaction process.
abstract boolean setupTransactionData | ( | SHAiButtonUser | user | ) | throws OneWireException, OneWireIOException [pure virtual] |
Setups initial transaction data on SHAiButtonUser. This step creates the account data file, signs it with the coprocessor, and writes it to the iButton.
Implemented in SHADebit, SHADebitUnsigned, and SHASoftAuth.
abstract boolean verifyUser | ( | SHAiButtonUser | user | ) | throws OneWireException, OneWireIOException [pure virtual] |
Verifies that SHAiButtonUser is a valid user of this service. This step writes a three byte challenge to the SHAiButtonUser before doing an authenticated read of the account data. The returned MAC is verified using the system authentication secret on the coprocessor. If the MAC matches that generated by the coprocessor, this function returns true.
Implemented in SHADebit, SHADebitUnsigned, and SHASoftAuth.
abstract boolean verifyTransactionData | ( | SHAiButtonUser | user | ) | throws OneWireException, OneWireIOException [pure virtual] |
Verifies account data is valid for this service. The user's account data is recreated on the coprocessor and signed using the system signing secret. If the recreated signature matches the signature in the account data, the account data is valid.
Implemented in SHADebit, SHADebitUnsigned, and SHASoftAuth.
abstract boolean executeTransaction | ( | SHAiButtonUser | user, | |
boolean | verifySuccess | |||
) | throws OneWireException, OneWireIOException [pure virtual] |
Performs the transaction. For any given transaction type, this step would involve updating any necessary account data, signing the account data using the coprocessor's system signing secret, and writing the updated account data to the user iButton
Implemented in SHADebit, SHADebitUnsigned, and SHASoftAuth.
abstract boolean setParameter | ( | int | type, | |
int | param | |||
) | [pure virtual] |
Sets a particular parameter for this transaction. Parameters are specified in the class documentation for the specific type of transaction that is being peformed.
Implemented in SHADebit, SHADebitUnsigned, and SHASoftAuth.
abstract int getParameter | ( | int | type | ) | [pure virtual] |
Retrieves the value of a particular parameter for this transaction. Parameters are specified in the class documentation for the specific type of transaction that is being peformed.
Implemented in SHADebit, SHADebitUnsigned, and SHASoftAuth.
abstract void resetParameters | ( | ) | [pure virtual] |
Resets the value of all parameters for this transaction. Parameters are specified in the class documentation for the specific type of transaction that is being peformed.
Implemented in SHADebit, SHADebitUnsigned, and SHASoftAuth.