C H A P T E R  6

Ant Tasks Example

Following is a complete build.xml file that can be used to compile, convert, verify, and deploy the JavaPurse demo applet that comes with Java Card development kit in cref and then run a demo script.

To use this example, copy and paste CODE EXAMPLE 6-1in build.xml file. Place the build.xml file in <Java Card Dev Kit Directory>/samples/src directory. Create a subdirectory in src directory named scripts and place testpurse.scr (CODE EXAMPLE 6-2) in that directory. At this point you should be able to run Ant in the src directory to run the example.

 


CODE EXAMPLE 6-1 build.xml

<?xml version="1.0"?>

<project name="Java Card(TM) Tasks Sample" default="all" basedir=".">

 

<!-- the directory structure under the base directory -->

<property name="sourceroot" value="." />

<property name="classroot" value="classes" />

<property name="samples.eeprom" value="eeprom" />

<property name="samples.scripts" value="scripts" />

<property name="exportmap" value="exportmap" />

 

<!-- the directories where the Java Card(TM) export are located could go -->

<!-- into a properties file-->

<property name="jcardkit_home" value="../.." />

<property name="jcardkit_exports" value="${jcardkit_home}/api_export_files" />

<property name="jcardkit_libs" value="${jcardkit_home}/lib" />

 

<!-- Definitions for tasks for Java Card tools -->

<taskdef name="apdutool"

classname="com.sun.javacard.ant.tasks.APDUToolTask" />

<taskdef name="capgen"

classname="com.sun.javacard.ant.tasks.CapgenTask" />

<taskdef name="maskgen"

classname="com.sun.javacard.ant.tasks.MaskgenTask" />

<taskdef name="deploycap"

classname="com.sun.javacard.ant.tasks.DeployCapTask" />

<taskdef name="exp2text"

classname="com.sun.javacard.ant.tasks.Exp2TextTask" />

<taskdef name="convert"

classname="com.sun.javacard.ant.tasks.ConverterTask" />

<taskdef name="verifyexport"

classname="com.sun.javacard.ant.tasks.VerifyExpTask" />

<taskdef name="verifycap"

classname="com.sun.javacard.ant.tasks.VerifyCapTask" />

<taskdef name="verifyrevision"

classname="com.sun.javacard.ant.tasks.VerifyRevTask" />

<taskdef name="scriptgen"

classname="com.sun.javacard.ant.tasks.ScriptgenTask" />

<typedef name="appletnameaid"

classname="com.sun.javacard.ant.types.AppletNameAID" />

<typedef name="jcainputfile"

classname="com.sun.javacard.ant.types.JCAInputFile" />

<typedef name="exportfiles"

classname="org.apache.tools.ant.types.FileSet" />

<!-- set the classpath at minimum to the Java Card API but also for -->

<!-- all other APIs needed in the project-->

<path id="classpath" description="Sets the classpath to Java Card API and tools">

<pathelement path="${jcardkit_home}/lib/api.jar"/>

<pathelement path="${jcardkit_home}/lib/converter.jar"/>

<pathelement path="${jcardkit_home}/lib/offcardverifier.jar"/>

<pathelement path="${jcardkit_home}/lib/scriptgen.jar"/>

<pathelement path="${jcardkit_home}/lib/apdutool.jar"/>

<pathelement path="${jcardkit_home}/lib/apduio.jar"/>

<pathelement path="."/>

</path>

<!-- set the export path to the Java Card export files -->

<path id="export" description="set the export file path">

<pathelement path="${jcardkit_exports}" />

<pathelement path="./classes"/>

</path>

 

<!-- compile section -->

<target name="compile_sources" description="Build classes">

<!-- Make destination directory -->

<mkdir dir="${classroot}"/>

<!-- Compile the java code from ${src} to ${classes} -->

<javac debug="yes"

optimize="no"

srcdir="${sourceroot}/com/sun/javacard/samples/SampleLibrary"

destdir="${classroot}">

<classpath refid="classpath"/>

</javac>

<javac debug="yes"

optimize="no"

srcdir="${sourceroot}/com/sun/javacard/samples/JavaPurse"

destdir="${classroot}">

<classpath refid="classpath"/>

</javac>

</target>

 

<!-- Convert SampleLibrary before converting JavaPurse because JavaPurse -->

<!-- imports SampleLibrary -->

<target name="convert_library" depends="compile_sources"

description="Build export file and CAP file for SampleLibrary">

<convert

EXP="true"

CAP="true"

packagename="com.sun.javacard.samples.SampleLibrary"

packageaid="0xA0:0x0:0x0:0x0:0x62:0x3:0x1:0xC:0x4"

majorminorversion="1.0"

classdir="${classroot}"

outputdirectory="${classroot}">

<exportpath refid="export"/>

<classpath refid="classpath"/>

</convert>

</target>

 

<!-- Convert JavaPurse -->

<target name="convert_purse" depends="convert_library"

description="Build cap file for the JavaPurse package">

<convert

CAP="true"

packagename="com.sun.javacard.samples.JavaPurse"

packageaid="0xA0:0x0:0x0:0x0:0x62:0x3:0x1:0xC:0x2"

majorminorversion="1.0"

classdir="${classroot}"

outputdirectory="${classroot}">

<AppletNameAID

appletname="com.sun.javacard.samples.JavaPurse.JavaPurse"

aid="0xa0:0x0:0x0:0x0:0x62:0x3:0x1:0xc:0x2:0x1"/>

<exportpath refid="export"/>

<classpath refid="classpath"/>

</convert>

</target>

 

<!-- Verify CAP file for JavaPurse -->

<target name="verify_purse" depends="convert_purse" >

<verifycap

CapFile="${classroot}/com/sun/javacard/samples/JavaPurse/javacard/JavaPurse.cap" >

<exportfiles file="${classroot}/com/sun/javacard/samples/SampleLibrary/

javacard/SampleLibrary.exp" />

<exportfiles dir="${jcardkit_exports}">

<include name="**/javacard/framework/javacard/framework.exp"/>

<include name="**/lang.exp"/>

</exportfiles>

<classpath refid="classpath"/>

</verifycap>

</target>

 

<!-- Deploy SampleLibrary before deploying JavaPurse because -->

<!-- JavaPurse depends on SampleLibrary -->

<target name="deploy_sample_library" depends="convert_library" >

<!-- Make EEPROM directory -->

<mkdir dir="${samples.eeprom}"/>

<deploycap

outEEFile="${samples.eeprom}/EEFile"

CrefExe="${jcardkit_home}/bin/cref.exe"

CapFile="${classroot}/com/sun/javacard/samples/SampleLibrary/javacard/SampleLibrary.cap" >

<classpath refid="classpath"/>

</deploycap>

</target>

 

<!-- Deploy JavaPurse using the resulting EEPROM image from deploying SampleLibrary -->

<target name="deploy_java_purse" depends="convert_purse, deploy_sample_library" >

<deploycap

inEEFile="${samples.eeprom}/EEFile"

outEEFile="${samples.eeprom}/EEFile"

CrefExe="${jcardkit_home}/bin/cref.exe"

CapFile="${classroot}/com/sun/javacard/samples/JavaPurse/javacard/JavaPurse.cap" >

<classpath refid="classpath"/>

</deploycap>

</target>

 

<!-- Now that JavaPurse is deployed we can run our test script -->

<target name="run_test_script" depends="deploy_java_purse" >

<apdutool

scriptFile="${samples.scripts}/testpurse.scr"

inEEFile="${samples.eeprom}/EEFile"

outEEFile="${samples.eeprom}/EEFile"

CheckDownloadFailure="false"

CrefExe="${jcardkit_home}/bin/cref.exe">

<classpath refid="classpath"/>

</apdutool>

</target>

 

<!-- Clean output directories -->

<target name="clean">

<delete dir="${classroot}" />

<delete dir="${samples.eeprom}" />

</target>

 

<!-- Clean, compile, convert, verify, deploy cap files and run test script -->

<target name="all" depends="clean, run_test_script" />

 

</project>


The following code example is for testpurse.scr.


CODE EXAMPLE 6-2 testpurse.scr

//+

// Copyright 2005 Sun Microsystems, Inc. All rights reserved.

//-

 

powerup;

 

echo "****Select the installer applet";

0x00 0xA4 0x04 0x00 0x09 0xa0 0x00 0x00 0x00 0x62 0x03 0x01 0x08 0x01 0x7F;

// 90 00 = SW_NO_ERROR

 

echo "****create JavaPurse";

0x80 0xB8 0x00 0x00 0x0c 0x0a 0xa0 0x00 0x00 0x00 0x62 0x03 0x01 0x0c 0x2 0x01 0x00 0x7F;

 

/////////////////////////////////////////////////////////////////////

// Initialize JavaPurse

/////////////////////////////////////////////////////////////////////

 

echo "****Select JavaPurse";

0x00 0xa4 0x04 0x00 10 0xa0 0 0 0 0x62 3 1 0xc 2 1 127;

// 90 00 = SW_NO_ERROR

 

echo "****Initialize Parameter Update";

0x80 0x24 0x00 0x00 0x00 0x7F;

//00 00 00 00 0c 1f 63 00 01 90 00 = Purse ID : 0x00000000; ExpDate 12/31/99; PUN 1

//For the second and consecutive runs it can be 69 82

 

echo "****Complete Parameter Update: CAD ID 0x11223344; Set Master PIN 12345678";

0x80 0x26 0x00 0x00 0x1A 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xC1 0x08 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F;

// 00 00 00 00 00 00 00 00 90 00

// For second and consecutive runs it can be 91 04

 

echo "****Verify PIN : Master PIN";

0x00 0x20 0x00 0x81 0x08 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x7F;

// 90 00;

 

echo "****Initialize Parameter Update";

0x80 0x24 0x00 0x00 0x00 0x7F;

// 00 00 00 00 0c 1f 63 00 02 90 00 = Purse ID : 0x00000000; ExpDate 12/31/99; PUN 2

 

echo "****Complete Parameter Update: CAD ID 0x11223344; Set User PIN 1234";

0x80 0x26 0x00 0x00 0x16 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xC2 0x04 0x01 0x02 0x03 0x04 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F;

// 00 00 00 00 00 00 00 00 90 00;

 

echo "****Initialize Parameter Update";

0x80 0x24 0x00 0x00 0x00 0x7F;

// 00 00 00 00 0c 1f 63 00 03 90 00 = Purse ID : 0x00000000; ExpDate 12/31/99; PUN 3

 

echo "****Complete Parameter Update: CAD ID 0x11223344; Set ExpDate 12/31/98";

0x80 0x26 0x00 0x00 0x15 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xC5 0x03 0x0c 0x1f 0x62 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F;

// 00 00 00 00 00 00 00 00 90 00;

 

echo "****Initialize Parameter Update";

0x80 0x24 0x00 0x00 0x00 0x7F;

// 00 00 00 00 0c 1f 62 00 04 90 00 = Purse ID : 0x00000000; ExpDate 12/31/98; PUN 4

 

echo "****Complete Parameter Update: CAD ID 0x11223344; Set Purse ID 0x05050505";

0x80 0x26 0x00 0x00 0x16 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xC6 0x04 0x05 0x05 0x05 0x05 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F;

// 00 00 00 00 00 00 00 00 90 00;

 

echo "****Initialize Parameter Update";

0x80 0x24 0x00 0x00 0x00 0x7F;

// 05 05 05 05 0c 1f 62 00 05 90 00 = Purse ID : 0x05050505; ExpDate 12/31/98; PUN 5

 

echo "****Complete Parameter Update: CAD ID 0x11223344; Set Max Balance $320.00;";

0x80 0x26 0x00 0x00 0x14 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xC7 0x02 0x7D 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F;

// 00 00 00 00 00 00 00 00 90 00;

 

echo "****Initialize Parameter Update";

0x80 0x24 0x00 0x00 0x00 0x7F;

// 05 05 05 05 0c 1f 62 00 06 90 00 = Purse ID : 0x05050505; ExpDate 12/31/98; PUN 6

 

echo "****Complete Parameter Update: CAD ID 0x11223344; Set Max Transaction $30.00;";

0x80 0x26 0x00 0x00 0x14 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xC8 0x02 0x0B 0xB8 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F;

// 00 00 00 00 00 00 00 00 90 00;

 

echo "****Initialize Parameter Update";

0x80 0x24 0x00 0x00 0x00 0x7F;

// 05 05 05 05 0c 1f 62 00 07 90 00 = Purse ID : 0x05050505; ExpDate 12/31/98; PUN 7

 

echo "****Complete Parameter Update: CAD ID 0x11223344; Set Java Purse Version 2.1.0.1";

0x80 0x26 0x00 0x00 0x16 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xC9 0x04 0x02 0x01 0x00 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F;

// 00 00 00 00 00 00 00 00 90 00;

 

echo "****Initialize Parameter Update";

0x80 0x24 0x00 0x00 0x00 0x7F;

// 05 05 05 05 0c 1f 62 00 08 90 00 = Purse ID : 0x05050505; ExpDate 12/31/98; PUN 8

 

echo "****Complete Parameter Update: CAD ID 0x11223344; Loyalty1 = 0xa0,00,00,00,62,03,01,0c,05,01 ";

0x80 0x26 0x00 0x00 0x1E 0x11 0x22 0x33 0x44 0x00 0x00 0x00 0x00 0xCA 0x0C 0x33 0x55 0xA0 0x00 0x00 0x00 0x62 0x03 0x01 0x0C 0x05 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x7F;

// 00 00 00 00 00 00 00 00 90 00;

 

//////////////////////////////////////////////////////////////////////

// End of initialization session, all values are set up.

//////////////////////////////////////////////////////////////////////

 

//////////////////////////////////////////////////////////////////////

// Regular transaction session at CAD 22446688 in the Bank

//////////////////////////////////////////////////////////////////////

 

echo "****Select JavaPurse";

0x00 0xa4 0x04 0x00 10 0xa0 0 0 0 0x62 3 1 0xc 2 1 127;

// 90 00 = SW_NO_ERROR

 

echo "****Verify PIN (User PIN 01020304)";

0x00 0x20 0x00 0x82 0x04 0x01 0x02 0x03 0x04 0x00;

// 90 00;

 

echo "****Initialize Transaction: Credit $250.00 ";

0x80 0x20 0x01 0x00 0x0a 0x61 0xa8 0x22 0x44 0x66 0x88 0x00 0x00 0x00 0x00 0x7F;

// 05 05 05 05 0c 1f 62 00 00 00 01 00 00 00 00 00 00 00 00 90 00

//= Purse ID : 0x05050505; ExpDate 12/31/98; TN=1

 

echo "****Complete Transaction: Date 10/27/97; Time 15:33";

0x80 0x22 0x00 0x00 0x0d 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x0a 0x1b 0x61 0x0f 0x21 0x7F;

// 61 a8 00 00 00 00 00 00 00 00 90 00 = Purse Balance $250.00;

 

echo "****Initialize Transaction: Debit $25.00;";

0x80 0x20 0x02 0x00 0x0a 0x09 0xc4 0x22 0x44 0x66 0x88 0x00 0x00 0x00 0x00 0x7F;

// 05 05 05 05 0c 1f 62 61 a8 00 02 00 00 00 00 00 00 00 00 90 00;

//= Purse ID : 0x05050505; ExpDate 12/31/98; TN=2

 

echo "****Complete Transaction: Date 10/27/97; Time 15:35";

0x80 0x22 0x00 0x00 0x0d 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x0a 0x1b 0x61 0x0f 0x23 0x7F;

// 57 e4 00 00 00 00 00 00 00 00 90 00 = Purse Balance $225.00;

 

/////////////////////////////////////////////////////////////////////

// Regular transaction session at CAD 33557799 in a store

/////////////////////////////////////////////////////////////////////

 

echo "****Select JavaPurse";

0x00 0xa4 0x04 0x00 10 0xa0 0 0 0 0x62 3 1 0xc 2 1 127;

// 90 00 = SW_NO_ERROR

 

echo "****Verify PIN (User PIN 01020304)";

0x00 0x20 0x00 0x82 0x04 0x01 0x02 0x03 0x04 0x00;

// 90 00;

 

echo "****Initialize Transaction: Debit $22.95";

0x80 0x20 0x02 0x00 0x0a 0x08 0xf7 0x33 0x55 0x77 0x99 0x00 0x00 0x00 0x00 0x7F;

// 05 05 05 05 0c 1f 62 57 e4 00 03 00 00 00 00 00 00 00 00 90 00;

//= Purse ID : 0x05050505; ExpDate 12/31/98; TN=3

 

echo "****Complete Transaction: Date 10/27/97; Time 17:45";

0x80 0x22 0x00 0x00 0x0d 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x0a 0x1b 0x61 0x11 0x2d 0x7F;

// 4e ed 00 00 00 00 00 00 00 00 90 00 = Purse Balance $202.05

 

/////////////////////////////////////////////////////////////////////

// A session with various errors at CAD 33445566

/////////////////////////////////////////////////////////////////////

 

echo "****Select JavaPurse";

0x00 0xa4 0x04 0x00 10 0xa0 0 0 0 0x62 3 1 0xc 2 1 127;

// 90 00 = SW_NO_ERROR

 

echo "****Initialize Transaction: Debit $22.95";

0x80 0x20 0x02 0x00 0x0a 0x08 0xf7 0x33 0x44 0x55 0x66 0x00 0x00 0x00 0x00 0x7F;

// 69 82 = SW "Security Status Not Satisfied" : must present PIN first

 

echo "****Verify PIN (User PIN 01030507)";

0x00 0x20 0x00 0x82 0x04 0x01 0x03 0x05 0x07 0x00;

// 69 c4 = SW_PIN_FAILED, 4 tries remained

 

echo "****Initialize Transaction: Debit $22.95";

0x80 0x20 0x02 0x00 0x0a 0x08 0xf7 0x33 0x44 0x55 0x66 0x00 0x00 0x00 0x00 0x7F;

// 69 82 = SW "Security Status Not Satisfied"

 

echo "****Verify PIN (User PIN 01020304)";

0x00 0x20 0x00 0x82 0x04 0x01 0x02 0x03 0x04 0x00;

// 90 00 = SW_NO_ERROR

 

echo "****Complete Transaction: Date 10/28/97; Time 18:45";

0x80 0x22 0x00 0x00 0x0d 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x0a 0x1c 0x61 0x12 0x2d 0x7F;

// 91 04 = SW_COMMAND_OUT_OF_SEQUENCE: Complete command should follow valid Initialize

 

echo "****Initialize Transaction: Debit $22.95";

0x80 0x20 0x02 0x00 0x0a 0x08 0xf7 0x33 0x44 0x55 0x66 0x00 0x00 0x00 0x00 0x7F;

// 05 05 05 05 0c 1f 62 4e ed 00 04 00 00 00 00 00 00 00 00 90 00 = TN = 4; Balance = $202.05

 

echo "****Complete Transaction: Date 10/28/97; Time 18:48";

0x80 0x22 0x00 0x00 0x0d 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x11 0x0a 0x1c 0x61 0x12 0x30 0x7F;

// 91 05 = SW_WRONG_SIGNATURE: This attempt of transaction is recorded in the log

 

echo "****Complete Transaction: Date 10/28/97; Time 18:50;";

0x80 0x22 0x00 0x00 0x0d 0x35 0xa9 0x3b 0x26 0x50 0x58 0x97 0x93 0x0a 0x1c 0x61 0x12 0x32 0x7F;

// 91 04 = SW_COMMAND_OUT_OF_SEQUENCE

// (Transaction with a wrong signature is in a way completed,

// We can't retry with another signature.)

 

echo "****Initialize transaction: Debit $9.86";

0x80 0x20 0x02 0x00 0x0a 0x03 0xda 0x33 0x44 0x55 0x66 0x00 0x00 0x00 0x00 0x7F;

// 05 05 05 05 0c 1f 62 4e ed 00 05 00 00 00 00 00 00 00 00 90 00 = TN = 5; Balance = $202.05

 

echo "****Complete Transaction: Date 10/28/97; Time 18:53";

0x80 0x22 0x00 0x00 0x0d 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x0a 0x1c 0x61 0x12 0x35 0x7F;

// 4b 13 00 00 00 00 00 00 00 00 90 00 = Balance = $192.19

 

echo "****Initialize transaction: Debit $30.01";

0x80 0x20 0x02 0x00 0x0a 0x0b 0xb9 0x33 0x44 0x55 0x66 0x00 0x00 0x00 0x00 0x7F;

// 91 03 = SW_AMOUNT_TOO_HIGH (The Max Amount was set to $30.00)

 

echo "****Initialize transaction: Credit $127.82";

0x80 0x20 0x01 0x00 0x0a 0x31 0xee 0x33 0x44 0x55 0x66 0x00 0x00 0x00 0x00 0x7F;

// 91 01 = SW_CREDIT_TOO_HIGH (The Max Balance was set to $320.00,

// this transaction would bring it to 320.01)

 

/////////////////////////////////////////////////////////////////////

// Session of reading balance and log at CAD 22446688 in the Bank

/////////////////////////////////////////////////////////////////////

 

echo "****Select JavaPurse";

0x00 0xa4 0x04 0x00 10 0xa0 0 0 0 0x62 3 1 0xc 2 1 127;

// 90 00 = SW_NO_ERROR

 

echo "****Verify PIN (User PIN 01020304)";

0x00 0x20 0x00 0x82 0x04 0x01 0x02 0x03 0x04 0x00;

// 90 00;

 

echo "****Read the only record in Balances file : ";

echo "****SFI = 4 (00100), record N is specified in P1 => P2 = 00100100 = 0x24";

0x00 0xb2 0x01 0x24 0x00 0x7F;

// 4b 13 7d 00 0b b8 90 00 = Balance = $192.19,

// Max Balance = $320.00, Max Transaction = $30;

echo "*****Read the first record in log file";

echo "****SFI = 3 (00011), record N is specified in P1 => P2 = 00011100 = 0x1c";

0x00 0xb2 0x01 0x1c 0x00 0x7F;

// 00 05 02 03 da 33 44 55 66 0a 1c 61 12 35 4b 13 90 00 90 00

// TN = 5; Transaction Type = DEBIT(02); Amount = $9.86(03da); CAD ID 33445566;

// Date 10/28/97 (0a 1c 61); Time 18:53(12 35); Balance $192.19 (4b 13),

// SW = NO_ERROR (9000)

 

echo "****Read the second record in log file";

echo "****FI = 3 (00011), record N is specified in P1 => P2 = 00011100 = 0x1c";

0x00 0xb2 0x02 0x1c 0x00 0x7F;

// 00 04 02 08 f7 33 44 55 66 0a 1c 61 12 30 4e ed 91 05 90 00;

// TN = 4; Transaction Type = DEBIT(02); Amount = $22.95(08f7); CAD ID 33445566;

// Date 10/28/97 (0a 1c 61); Time 18:53(12 35); Balance $202.05 (4eed),

// SW_WRONG_SIGNATURE (9105)

// Attempt of the transaction is recorded, but balance wasn't change, see next record.

 

echo "****Read the third record in log file";

echo "****SFI = 3 (00011), record N is specified in P1 => P2 = 00011100 = 0x1c";

0x00 0xb2 0x03 0x1c 0x00 0x7F;

// 00 03 02 08 f7 33 55 77 99 0a 1b 61 12 2d 4e ed 90 00 90 00

// TN = 3; Transaction Type = DEBIT(02); Amount = $22.95(08f7); CAD ID 33557799;

// Date 10/27/97 (0a 1b 61); Time 18:45(12 2d); Balance $202.05 (4eed), SW = NO_ERROR (9000)

 

echo "****Read the fifth record in log file";

echo "**** = 3 (00011), record N is specified in P1 => P2 = 00011100 = 0x1c";

0x00 0xb2 0x05 0x1c 0x00 0x7F;

// 00 01 01 61 a8 22 44 66 88 0a 1b 61 0f 21 61 a8 90 00 90 00;

// TN = 1; Transaction Type = CREDIT(01); Amount = $250.00(61a8); CAD ID 22446688;

// Date 10/27/97 (0a 1b 61); Time 15:33(0f 21); Balance $250.00 (61a8), SW = NO_ERROR (9000)

 

echo "****Read the sixth record in log file";

echo "****SFI = 3 (00011), record N is specified in P1 => P2 = 00011100 = 0x1c";

0x00 0xb2 0x06 0x1c 0x00 0x7F;

// 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 90 00

// Empty record

 

echo "****Read Expiration Date from Parameters file";

echo "****SFI = 2 (00010), record tag 0xc5 is in P1 => P2 = 00010000 = 0x10;";

0x00 0xb2 0xc5 0x10 0x00 0x7F;

// 69 82 : SW Security status not satisfied -

// One has to present Master PIN to read Parameters

echo "****Verify PIN : Master PIN";

0x00 0x20 0x00 0x81 0x08 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x00;

// 90 00;

 

echo "****Read Expiration Date from Parameters file";

echo "****SFI = 2 (00010), record tag 0xc5 is in P1 => P2 = 00010000 = 0x10;";

0x00 0xb2 0xc5 0x10 0x00 0x7F;

// c5 03 0c 1f 62 90 00 = Tag = 0xc5, Exp. Date = 12/31/98 (0c 1f 62)

 

echo "****Select File: select EF under current DF (P1 = 0x02); FID = 0x9103";

0x00 0xa4 0x02 0x0c 0x02 0x91 0x03 0x00;

// 90 00;

 

echo "****Read the first record in the selected file";

echo "****currently selected file, record N is specified in P1 => P2 = 00000100 = 0x04";

0x00 0xb2 0x01 0x04 0x00 0x7F;

// 00 05 02 03 da 33 44 55 66 0a 1c 61 12 35 4b 13 90 00 90 00

// TN = 5; Transaction Type = DEBIT(02); Amount = $9.86(03da); CAD ID 33445566;

// Date 10/28/97 (0a 1c 61); Time 18:53(12 35); Balance $192.19 (4b 13),

// SW = NO_ERROR (9000)

// *** SCRIPT END ***

powerdown;