Datasheet
AN156
14 of 23
The SHAUser structure is used to maintain all pertinent information about a specific user token. Also, it
maintains state between successive calls to API functions. For example, the accountFile field is populated
when verifyUser is called, so the verifyData method uses this information for verifying the certificate
signature without re-reading the device.
struct SHAUser Figure 26
The SHACopr structure is used to maintain all system parameters. These parameters are, typically, stored
in a file on the coprocessor device.
struct SHACopr Figure 27
3.1 Initializing the Coprocessor
Initializing the coprocessor consists of two important steps: installing the system authentication secret and
installing the system signing secret. An optional third step is to write all of the system configuration data
to the iButton in the form of a file (see AN114). The configuration data doesn’t have to be stored on the
coprocessor iButton, but it’s convenient to keep the system parameters as portable as the coprocessor. As
an alternative, the file can be stored on a disk drive or the parameters can be hardcoded in your
application.
typedef struct {
// portnum and address of the device
int portnum;
uchar devAN[8];
uchar accountPageNumber; // page the user's account file is stored on
long writeCycleCounter; // Write cycle counter for account page
uchar responseMAC[20]; // MAC from Read Authenticated Page command
union {
uchar raw[32]; // used for direct writes to button only
DebitFile file; // use this for accessing individual fields
} accountFile;
} SHAUser;
typedef struct {
// portnum and address of the device
int portnum;
uchar devAN[8];
uchar serviceFilename[5]; // name of the account file stored on the user token
uchar signPageNumber; // memory page used for signing data (0 or 8)
uchar authPageNumber; // memory page used for storing master authentication secret
uchar wspcPageNumber; // memory page used for storing user's unique secret
uchar versionNumber; // version number of the transaction system.
uchar bindCode[7]; // Scratchpad binding data for producing unique secrets
uchar bindData[32]; // Data page binding data for producing unique secrets
uchar signChlg[3]; // signature used when signing account data
uchar initSignature[20]; // challenge used when signing account data
uchar* providerName; // name of the transaction system provider
uchar* auxilliaryData; // any other pertinent information
uchar encCode; // encryption code
uchar ds1961Scompatible; // indicates that secret was padded for DS1961S
} SHACopr;










