Datasheet

AN156
4 of 23
Although there are a few other parameters for a system that are stored in the service configuration file,
these are the most essential parameters. The name of the provider and the version number of the system,
for example, are not necessary for a minimal-functionality debit application. Initializing the coprocessor
can be done by simply calling the constructor for SHAiButtonCopr, passing all the parameters as
arguments. For a detailed list of all the parameters, refer to the JavaDocs for the 1-Wire API for Java.
Initializing the Coprocessor with SHAiButtonCopr Figure 3
Using just the OneWireContainer18 class, it’s possible to initialize the container without the
com.dalsemi.onewire.application.sha package. The following code snippet demonstrates the steps for
installing the secrets onto the device using just the OneWireContainer18. Note that this code segment is
nearly identical to the actual implementation of the SHAiButtonCopr constructor used in Figure 3.
Container-Level Initialization of Coprocessor Figure 4
/* install the signing secret */
coprDevice.installMasterSecret(signPageNumber, inputSignSecret, signPageNumber&7);
/* install the authentication secret */
coprDevice.installMasterSecret(authPageNumber, inputAuthSecret, authPageNumber&7);
/* create the configuration file */
OWFileOutputSream fos = new OWFileOutputStream(shaDevice, “COPR.0”);
/* Write all the service parameters to the output stream (see AN157 for format) */
fos.write(acctFilename,0,4);
fos.write(acctFile);
fos.write(signPageNumber);
fos.write(authPageNumber);
fos.write(wspcPageNumber);
fos.write(0); //version number
fos.write(0x01); //month
fos.write(0x01); //day
fos.write(0x07); //year MSB
fos.write(0xD1); //year LSB –> 1/1/2001
fos.write(bindData);
fos.write(bindCode);
fos.write(signingChlg);
fos.write(l_providerName.length);
fos.write(l_initSignature.length);
fos.write(l_auxData.length);
fos.write(“Maxim”.getBytes()); //Provider name
fos.write(initSignature);
fos.write(“”.getBytes()); //auxilliary info
fos.write(l_encCode); //encryption code
fos.write(0); //DS1961S Compatibility flag (see AN157)
fos.close();
/* Create the new instance of SHAiButtonCopr, ready to perform transactions! */
SHAiButtonCopr copr = new SHAiButtonCopr(coprDevice, “COPR.0”);
// . . . Find the DS1963S iButton on the 1-Wire Network
OneWireContainer18 coprDevice = // see ‘overview’ in the JavaDocs for finding devices
/* Create the new instance of SHAiButtonCopr, ready to perform transactions! */
SHAiButtonCopr copr
= new SHAiButtonCopr(coprDevice, “COPR.0”, true, signPageNumber, authPageNumber,
wspcPageNumber, 1, 1, acctFileExt, acctFilename, “Maxim”, bindData, bindCode,
“”, initSignature, signingChlg, inputSignSecret, inputAuthSecret);