Datasheet

AN156
2 of 23
There are two sample transactions that extend SHATransaction: SHADebit and SHADebitUnsigned. The
first implements an account debit system, where an initial account balance is stored in a signed monetary
certificate (see AN151). During typical use, a user is validated as a member of the system and the
signature on the certificate is verified. If the user and data are both valid, the balance stored in the
monetary certificate is updated, a new signature is generated, and the certificate is written back to the
device. The second transaction (SHADebitUnsigned) uses an unsigned monetary certificate and utilizes
the unused space to implement a double-write scheme, protecting the data in EEPROM devices. This
transaction type (for use with the DS1961S/DS2432 1-Wire devices) is covered in another application
note.
SHA transactions have, as a constant member, a SHAiButtonCopr (the class that represents a DS1963S
that has been initialized to perform as a coprocessor in SHA transactions). In that sense, a
SHATransaction can be thought of as an extension to the SHAiButtonCopr. It serves the same purpose as
the "decorator" classes in Java in that it separates the "thing to sign with" from "what it's signing." That
way, the "thing to sign with" (i.e. the coprocessor, SHAiButtonCopr) can be easily moved to different
systems ("what it's signing") with minimal coding for the application developer. In addition, a
SHAiButtonCoprVM, or rather a simulated coprocessor, can be used in place of a hardware DS1963S.
This class is provided as a convenience, but for optimal security a hardware coprocessor is recommended.
Inheritance Hierarchy of Package Figure 1
Every method in SHATransaction has a SHAiButtonUser as a parameter. Provided with the API are two
user objects: SHAiButtonUser33 and SHAiButtonUser18. Although the default implementation of
SHAiButtonUser only supports the two kinds of SHA iButtons (DS1961S/DS2432 family 0x33 and
DS1963S family 0x18), the concept of a user of a SHATransaction could be extended to support any 1-
Wire memory device. The SHAiButtonUser33 and SHAiButtonUser18 are handy extensions, however, as
they both provide authentication along with carrying the required account data. If iButton authentication
SHADebit
Signed eCash
SHAUnsignedDebit
Unsigned eCash
SHATransaction
Abstract Superclass
SHAiButtonUser18
DS1963S User Tokens
SHAiButtonUser33
DS1961S/DS2432 User Tokens
SHAiButtonUser
Abstract Superclass
SHAiButtonCoprVM
Software Simulated Coprcessor
SHAiButtonCopr
DS1963S Coprocessor