Home > Products > USIM Commander > User Guide

 


User Guide

The following keywords may be used in USIM Commander scripts:

 

 

2GMode

Sends all future commands to the card with class byte 'A0'. The only exception is commands sent using the "Apdu" keyword, where the class byte is explicitly specified.

Example Script Code:

// Set up for GSM communications

2GMode

 

// Send a Status command

Status

 

3GMode

Sends all future commands to the card with class byte '00' or '08' as appropriate. The only exception is commands sent using the "Apdu" keyword, where the class byte is explicitly specified.

USIM Commander defaults to this mode.

Example Script Code:

// Set up for GSM communications

3GMode

 

// Send a Select USIM command

SelectApplication

 

Apdu <data> [<data> .. <data>]

Sends an ISO 7816-3 APDU command to the SIM. The data supplied must specify CLA, INS, P1, P2 & P3 as a minimum, plus  any  command data required for that instruction.

Example Script Code:

// VerifyCHV10 using an Apdu script command

Apdu A0 20 00 0A 08 3132333435363738

 

// Another way, this time using variables

Set $CLA = A0

Set $INS = 20

Set $P1 = 00

Set $P2 = 0B

Set $P3 = 08

Set $commandData = "12345678"

Set $verifyADM = $CLA $INS $P1 $P2 $P3 $commandData

Apdu $verifyADM

 

ChangeCHV <chv num> <old chv> <new chv>

This command sends a CHANGE CHV command APDU to the SIM. The CHV number and old and new values must be specified. Where the old and new values are less than 8 bytes, the command will automatically add trailing 'FF' bytes.

Example Script Code:

// Change PIN1 using standard 4 character values

ChangeCHV 1 "1234" "0000"

 

// Repeat above, but use variables this time

Set $chvNum = 1

Set $oldValue = "1234"

Set $newValue = "0000"

UnblockCHV $chvNum $oldValue $newValue

 

Channel  0 | 1 | 2 | 3

Sets the channel bits of the class byte for all future commands. The channel defaults to 0 and must be a value between 0 and 3. The only exception is commands sent using the "Apdu" keyword, where the class byte (and therefore channel bits) are explicitly specified.

Example Script Code:

// Set the channel to be 1

Channel 1

 

// Send a Status command (on channel 1)

Status

 

// Now set the channel back to 0

Channel 0

 

// Send a Status command again (this time with back on channel 0)

Status

 

Class  <Class Byte>

Forces the class byte for all commands to be this value. The only exception is commands sent using the "Apdu" keyword, where the class byte is explicitly specified.

Example Script Code:

// Set the class to be GSM

Class A0

 

// Send a Status command

Status

 

// Now set the class to be UICC/USIM

Class 00

 

// Send a Status command again (this time with class '00')

Status

 

CloseTextFile

Closes any currently open text file.

Example Script Code:

OpenTextFile “Data2.txt”
// Read the first line if the file into a variable
ReadNextLine $line
// Read the second line of the file into a variable
ReadNextLine $line2
CloseTextFile

 

Comment "Text"

This command dimply displays a comment. This is useful to show where the script has got to.

Example Script Code:

Comment "Test 1"

 

// Other commands here

 

Comment "Test 2"

 

// Other commands here

 

ConvertTextToHexValue <$variable>

Takes a text string comprising of ASCII hex characters and converts this to the actual hex representation.

Example Script Code:

Set $data = “3F 00 7F 10 6F 3A”
ConvertTextToHexValue $data
// $data is now '3F007F106F3A' (6 bytes)

 

Crop <$variable> <offset> [<length>]

This command reduces the size of a variable by removing all data up to the offset specified. Optionally, you can also specify a length, which has the effect of removing data from the end. Offsets start from 0 with this command, unlike for GSM command APDUs.

Example Script Code:

Set $data = 0102030405060708

 

// Chop off the first two  bytes

Crop $data 2

// $data is now 030405060708

 

// Chop off the last byte

Crop $data 0 5

// $data is now 0304050607

 

// Chop off the first and last byte

Crop $data 1 3

// $data is now 040506

 

CropTLV <$variable> <tag>

This command locates the specified tag in the given variable data, then sets that variable to be only the value part of that tag. The command is able to distinguish between BER-TLV and SIMPLE-TLV objects.

Note that the "comprehension required" bits in both the specified tag and the tags in the variable are ignored for the comparison.

Example Script Code:

Set $data = D0 0C 81 03 01 25 00 82 02 81 82 84 01 00

// First locate the Proactive Command tag
Set $proactive = $data
CropTLV $proactive D0

// $proactive is now 81 03 01 25 00 82 02 81 82 84 01 00

// Now locate the Device Identities tag *inside* the proactive
// command tag
Set $device = $proactive
CropTLV $device 82

// $device is now 8182

// Now locate the Command Details tag, again *inside* the
// proactive command tag.
Set $command = $proactive
CropTLV $command 81

// $command is now 012500

 

Decrement <$variable>

Subtracts 1 to the current variable value. Variables can be of any length.

Example Script Code:

Set $apple = 04

Set $pear = 01 FE

Set $banana = 000000000000

 

Decrement $apple

// $apple is now '03'

 

DEcrement $pear

// $pear is now '01 FD'

 

Decrement $banana

// $banana is now 'FFFFFFFFFFFF'

 

DisableCHV <CHV1 value>

This command sends a DISABLE CHV command APDU to the SIM. The CHV value must be specified. Where the value is less than 8 bytes, the command will automatically add trailing 'FF' bytes.

Example Script Code:

// Disable PIN1 using a standard 4 character value

DisableCHV "1234"

 

// Repeat above, but use variables and hex data this time

Set $value = 31 32 33 34

DisableCHV $value

 

DisplayAsText <$variable>

Variables are normally displayed in hex. This command displays the variable as a text string.

Example Script Code:

// Get the proactive command

Fetch

Set $data = $responseData

 

// Find the alpha identifier

CropTLV $data 85

 

DisplayAsText $data

 

EnableCHV <CHV1 value>

This command sends an ENABLE CHV command APDU to the SIM. The CHV value must be specified. Where the value is less than 8 bytes, the command will automatically add trailing 'FF' bytes.

Example Script Code:

// Enable PIN1 using a standard 4 character value

EnableCHV "1234"

 

// Repeat above, but use variables and hex data this time

Set $value = 31 32 33 34

EnableCHV $value

 

Envelope  <data>

Sends an ENVELOPE command APDU to the SIM, the content of which is defined by the specified data.

Example Script Code:

// Start the initialisation

TerminalProfile

 

// Get the SIM menu and respond positively to it

Fetch

TerminalResponse

 

// Send an ENVELOPE (Menu Selection) selecting menu item 5

Envelope D30782020181900105

 

// A much easier way of course is to send this command instead

Envelope_MenuSelection 5

 

Envelope_CellBroadcastDownload  <page>

Sends an ENVELOPE (Cell Broadcast Download) APDU to the SIM, together with the page data specified.

If the page data is less than 88 bytes then the remainder of the page is automatically padded with 'FF' bytes.

Example Script Code:

// Build the CB message

Set $text = "X=40123,Y=354,T=15,H=1,DD=56,COB=4,ALN=221"

Pack $text

Set $page = 001000C00011 $text

 

// Simulate the CB download

Envelope_cellBroadcastDownload $page

 

Envelope_EventDownload_LocationStatus  <data> | NoService | LimitedService

Sends an ENVELOPE (EVENT DOWNLOAD - Location status) APDU to the SIM, together with the location data specified.

Example Script Code:

// Define some location data

Set $network = 45F301

Set $lac = 2191

Set $cellID = 017A

Set $locationData = $network $lac $cellID

 

// Send this down using the Envelope command

Envelope_EventDownload_LocationStatus $locationData

 

// Alternatively, indicate we're out of coverage

Envelope_EventDownload_LocationStatus NoService

 

Envelope_MenuSelection  <item ID>

Sends an ENVELOPE (Menu Selection) APDU to the SIM, selecting the item ID specified.

Example Script Code:

// Start the initialisation

TerminalProfile

 

// Get the SIM menu and respond positively to it

Fetch

TerminalResponse

 

// Select item 3 from the menu

Envelope_MenuSelection 3

 

// This should result in a SELECT ITEM proactive command

Fetch

 

// Select Item 2 in the list

TerminalResponse_SelectItem 2

 

Envelope_SMSPPDownload <address>  <tpdu>

Sends an ENVELOPE (SMS-PP Download) APDU to the SIM, together with the SMSC address and TPDU object data specified.

Example Script Code:

// Set up the SMS data

Set $smscAddress = 0481074325F1

 

Set $tpduStart = 040C91447717499330 000020102241117200

Set $userData = "This is a text message"

Pack $userData

Set $tpdu = $tpduStart PackedLength($userData) $userData

 

// Send the SMS-PP download

Envelope_SMSPPDownload $smscAddress $tpdu

 

Execute <script file>

Executes all of the script commands contained within the specified file, before continuing with the current script file.

There is no limit to nesting, so embedded scripts can also execute scripts.

Example Script Code:

// Set up some variables to start with

Execute file_id_variables.txt

 

// Now perform the testing

Select $MF

Select $DF_GSM

Select $EF_IMSI

ReadBinary

 

GetResponse

Sends a GET RESPONSE command APDU to the SIM.

Example Script Code:

Select 7F20

GetResponse

 

Goto

Moves unconditionally to later part of the script.

Example Script Code:

Select 7F20
Goto here

 

// This part will not be executed

Select 3F00

 

here:

 

// This part will

Select 6F7E

 

Goto end

 

// Skip this bit

ReadBinary

 

end:

// All done!

 

HasBitMaskClear

Allows checking of individual bits cleared in a data value

Example Script Code:

Set $data = 4100
 

If ($data HasBitMaskSet 2100)

{

  // This condition is false

}

 

If ($data HasBitMaskSet 2000)

{

  // This condition is true

}

 

HasBitMaskSet

Allows checking of individual bits set in a data value

Example Script Code:

Set $data = 4100
 

If ($data HasBitMaskSet 4300)

{

  // This condition is false

}

 

If ($data HasBitMaskSet 4100)

{

  // This condition is true

}

 

HasMoreLines

This condition is True if there are more tokens to be read from the latest line read from the currently open text file.

Example Script Code:

OpenTextFile “Data2.txt”
While (HasMoreLines)
{
	// Read the first line if the file into a variable
	ReadNextLine $line
}
CloseTextFile

 

HasMoreTokens

This condition is True if there are more tokens to be read from the latest line read from the currently open text file.

Example Script Code:

OpenTextFile “Data2.txt”
ReadNextLine $line
While (HasMoreTokens)
{
	ReadNextToken $token
}
CloseTextFile
// If the line was "THIS IS,A TEST" the tokens would be:
"THIS"
"IS"
"A"
"TEST"

 

If (<condition>) { ... }

Allows flow control in scripts

Example Script Code:

Set $data = 03 04 05 06
 

If ($data = 03040506)

  Fail

 

If ($data != $expectedData)

{

  Set $error = True

  Fail

}

 

If ($data > 00)

  Comment "Found it!"

 

If ($data Contains $patternData)

{

  Set $error = True

  Fail

}

 

Select 7F20

 

If (GoodStatus = False)

{

  Comment "Could not select GSM directory"

  Comment "Please check card!"

}

 

If (GoodStatus = True)

  Pass

 

Increment <$variable>

Adds 1 to the current variable value. Variables can be of any length.

Example Script Code:

Set $apple = 00

Set $pear = 22 33 FF

Set $banana = FFFF

 

Increment $apple

// $apple is now '01'

 

Increment $pear

// $pear is now '22 34 00'

 

Increment $banana

// $banana is now '010000' - note the field size has been

// increased to accommodate the new value

 

Invalidate

Sends an INVALIDATE command APDU to the SIM.

Example Script Code:

VerifyCHV 1 "1234"

Select 7F20

Select 6F07

Invalidate

 

Length(<$variable>)

Used to provide a length value for the length of a variable.

Example Script Code:

Set $text = "This is a text string"

Set $length = Length($text)

// $length will bet set to 21 decimal ('15' hex)

 

Set $tlv = 81 $length $text

 

// Alternatively...

Set $tlv = 81 Length($text) $text

 

OpenTextFile <filename>

Opens any text file so that data can be read from it and processed by the script.

Only one text file may be open at a time.

Example Script Code:

OpenTextFile “Data2.txt”
// Read the first line if the file into a variable
ReadNextLine $line
// Read the second line of the file into a variable
ReadNextLine $line2
CloseTextFile

 

Pack <$variable>

This command performs 8-bit packing of the specified variable, which is assumed to be a text string.

Example Script Code:

Set $text = "Here is the text to be packed"

 

Pack $text

// The text is now packed.

 

PackedLength(<$variable>)

Used to provide a numeric value for the number of characters in a packed text string variable.

Example Script Code:

Set $text = "This is a text string"

Set $length = Length($text)

 

Pack $text

Set $packedLength = Length($text)

 

// $packedLength will be smaller than $length

 

Pad <$variable> <padding byte> <length>

This command appends a number of padding bytes to a variable to provide a specific kength.

Example Script Code:

Set $data = 01020304

 

// Pad the data out to 10 bytes with 'FF'

Pad $data FF 0A

// $data is now 01020304FFFFFFFFFFFF

 

// No pad the data out further to 14 bytes, this time with '00'

Pad $data 00 0E

// $data is now 01020304FFFFFFFFFFFF00000000

 

Parser <delimeters>

Sets the delimiters for the ReadNextToken command.

Example Script Code:

OpenTextFile “Data2.txt”
Parser "-$%"
ReadNextLine $line
While (HasMoreTokens)
{
	ReadNextToken $token
}
CloseTextFile
// If the line was "THIS-IS$A%TEST" the tokens would be:
"THIS"
"IS"
"A"
"TEST"

 

Pass

Terminates the script immediately indicating a PASS condition.

Example Script Code:

Set $badStatus = 6F00

 

Select $MF

Select $DF_GSM

Select $EF_PHASE

ReadRecord

FailIfEqual $status $badStatus

Pass

 

Rehabilitate

Sends a REHABILITATE command APDU to the SIM.

Example Script Code:

VerifyCHV 1 "1234"

Select 7F20

Select 6F07

Rehabilitate

 

Reset

Performs an ICC reset on the inserted SIM.

Note, you do not need this at the start of a script as a reset is performed automatically by SIM commander.

Example Script Code:

// Show difference between cold & warm reset

Status

Reset

Status

 

ReadBinary [<offset>]

Sends a READ BINARY command APDU to the SIM, reading the contents of the currently selected transparent EF, and storing this in $responseData.

If no offset is specified, this command will read all available data in the EF. If an offset is specified, then the command will read all data available, starting from the offset.

Example Script Code:

// Select EF(LOCI) under the GSM directory

Select 3F00

Select 7F20

Select 6F78

// This file has READ policy of CHV1
VerifyCHV 1 "1234"

 

//Read all bytes in this file

ReadBinary

 

// Read from the 4th byte

ReadBinary 4

 

ReadNextLine <$variable>

Reads the next line (if any) of the currently open text file.

Example Script Code:

OpenTextFile “Data2.txt”
While (HasMoreLines)
{
	// Read the first line if the file into a variable
	ReadNextLine $line
}
CloseTextFile

 

ReadNextToken <$variable>

Reads the next token in the last read line from the currently open text file. Tokens are delimeted by default by commas, spaces and tabs.

Example Script Code:

OpenTextFile “Data2.txt”
ReadNextLine $line
While (HasMoreTokens)
{
	ReadNextToken $token
}
CloseTextFile
// If the line was "THIS IS,A TEST" the tokens would be:
"THIS"
"IS"
"A"
"TEST"

 

ReadRecord <record> | Next | Previous | Current

Sends a READ RECORD command APDU to the SIM, reading the contents of the currently selected linear-fixed or cyclic EF, and storing this in $responseData.

A  record number must be specified for absolute mode. Alternatively, the other modes can be specified as shown.

Example Script Code:

// Select EF(SMS) under the TELECOM directory

Select 3F00

Select 7F10

Select 6F3C

 

// This file has READ policy of CHV1
VerifyCHV 1 "1234"

 

// Read the 5th record
ReadRecord 5

 

// Read the next record
ReadRecord Next

 

// Read the current record
ReadRecord Current

 

RunGSMAlgorithm <RAND>

This command sends a RUN GSM ALGORITHM command APDU to the SIM. The RAND value must be specified. Where the value is less than 16 bytes, the command will automatically add trailing 'FF' bytes.

Example Script Code:

RunGSMAlgorithm 29452D6F8906727CC6A785E7822DAC5E

 

If Not Equal $responseData $expectedSRESandKc

  Fail

 

Pass

 

Select <fileID>

Sends a SELECT command APDU to the SIM, selecting the file ID specified. SIM commander will automatically send a GET RESPONSE command if the file selection is successful, storing the response data in "$responseData".

Example Script Code:

// Select EF(Phase) under the GSM directory

Set $EFphase = 6FAE

Select 3F00

Select 7F20

Select $EFphase

 

// Check the SIM is phase 2+

ReadBinary

 

If NotEqual $responseData 03
  Fail

 

Pass

 

// Worth noting that the following variables are automatically populated after a successful SELECT of an EF:

	$fileSize
	$recordLength
	$totalRecords

 

SelectApplication [<Index>]

Interrogates EF(DIR) for the required application AID then automatically selects it. <index> is the record number of EF(DIR) to select. If <index> is not specified, the first record chall be used.

Example Script Code:

// Set the USIM application (nromally 1st record of EF(DIR)

SelectApplication

 

// Send the third application

SelectApplication 3

 

Set <$variable> <data> [+|- <data>]

Sets a variable to a specific value. You may include several data items on the same line, which will be concatenated. These data items can be hex bytes, hex strings, other variables, or string literals.

All the data items must appear on a single line (no matter how long).

Example Script Code:

Set $apple = 010203

Set $pear = 04 05 06 07 08

Set $fruit = $apple $pear 09 0A 0B0C0D0E0F

 

Set $text1 = "Hello"

Set $text2 = ", World"

Set $allText = $text1 $text2

DisplayAsText $allText

 

// Use '#' to denote decimal values

Set $apple = #254

// Apple is stored as 'FE'

 

// You can now use '+' and '-' operators (V1.1.6 onwards):

Set $data = 1A

Set $newData = $data + 03

// $newData is now '1D'

 

ShiftBitsLeft

Moves all of the bits in a data value to the left one place.

Example Script Code:

Set $bitmask = 01

ShiftBitsLeft $bitmask

// $bitmask is now '02'

 

Set $bitmask = ’88 00 00 00 00’

ShiftBitsLeft $bitmask

// $bitmask is now ’10 00 00 00 00’ - note that bits fall off

// the left end to keep the field size constant

 

// Use this command to multiply values by 2

Set $value = 04

ShiftBitsLeft $value

// $value is now '08'

 

ShiftBitsRight

Moves all of the bits in a data value to the right one place.

Example Script Code:

Set $bitmask = 10

ShiftBitsRight $bitmask

// $bitmask is now '08'

 

Set $bitmask = ’88 00 00 00 01’

ShiftBitsLeft $bitmask

// $bitmask is now ’44 00 00 00 00’ - note that bits fall off

// the right end

 

// Use this command to divide values by 2

Set $value = 04

ShiftBitsRight $value

// $value is now '02'

 

Status

Sends a STATUS command APDU to the SIM.

Example Script Code:

TerminalProfile

 

Encourage toolkit activity

Status

Status

Status

 

Fetch

TerminalResponse

 

TerminalProfile [<data>]

Sends a TERMINAL PROFILE command APDU to the SIM, indicating that all services are available. If no <data> parameter is specified, the TERMINAL PROFILE command is sent with all command bytes set to 'FF'.

Example Script Code:

// Perform a TERMINAL PROFILE, which should result in a proactive command waiting.

TerminalProfile

 

// Or we could specify particular supported features:

// TerminalProfile FF3F7CFF

 

// Check the status indicates a proactive command

If Not Equal $sw1 91

  Fail

 

// Fetch the waiting proactive command

Fetch

 

Set $data $responseData

Set $commandDetailsTag 01

 

// Extract the Command Details TLV

CropTLV $data $commandDetailsTag

 

// Check the command is POLLING INTERVAL

If Not Equal $data 010301
  Fail

 

Pass

 

TerminalResponse [Back | Terminate]

Sends the appropriate TERMINAL RESPONSE command APDU to the SIM, where the result TLV indicates a successful execution of the proactive command previously fetched.

This command is suitable to respond to proactive commands that do not require additional parameters to be added, such as item IDs etc.

Suitable proactive commands include SET UP MENU, DISPLAY TEXT, POLL INTERVAL, PLAY TONE etc.

SIM Commander will automatically ensure the command details and device details TLV objects are correct for the proactive command.

Optionally, you can add the keywords "Back" or "Terminate" to indicate a backward move or termination of the SIM toolkit session.

Example Script Code:

// Perform a TERMINAL PROFILE, which should result in a proactive command waiting.

TerminalProfile

 

// Fetch the waiting proactive command (e.g. SET UP MENU)

Fetch

 

// Respond to it with a standard successful response

TerminalResponse

 

// Fetch the next proactive command (e.g. SELECT ITEM)

Fetch

 

// Respond to this with a backward move

TerminalResponse Back

 

TerminalResponse_GetInput <input data>

Sends the appropriate TERMINAL RESPONSE command APDU to the SIM, where the result TLV indicates a successful execution and resulting Item ID  of the GET INPUT  proactive command previously fetched.

SIM Commander will automatically ensure the command details and device details TLV objects are correct.

Example Script Code:

// Perform a TERMINAL PROFILE, which should result in a proactive command waiting.

TerminalProfile

 

// Fetch the waiting proactive command (GET INPUT)

Fetch

 

// Respond to it selecting item 3

TerminalResponse_GetInput "Gemini"

 

// Alternatively, respond with a session termination by user

TerminalResponse Terminate

 

TerminalResponse_IMEI <imei>

Sends the appropriate TERMINAL RESPONSE command APDU to the SIM, where the result TLV indicates a successful execution and resulting IMEI of the PROVIDE LOCAL INFORMATION (IMEI) proactive command previously fetched.

SIM Commander will automatically ensure the command details and device details TLV objects are correct.

Example Script Code:

// Perform a TERMINAL PROFILE, which should result in a proactive command waiting.

TerminalProfile

 

// Fetch the waiting proactive command (PROVIDE LOCAL INFO)

Fetch

 

// Respond to it with a standard successful response and IMEI

TerminalResponse_IMEI 12345678901234

 

TerminalResponse_LocationInformation <location data>

Sends the appropriate TERMINAL RESPONSE command APDU to the SIM, where the result TLV indicates a successful execution and resulting IMEI of the PROVIDE LOCAL INFORMATION (Location Information) proactive command previously fetched.

SIM Commander will automatically ensure the command details and device details TLV objects are correct.

Example Script Code:

// Perform a TERMINAL PROFILE, which should result in a proactive command waiting.

TerminalProfile

 

// Fetch the waiting proactive command (PROVIDE LOCAL INFO)

Fetch

 

// Define some location data

Set $network = 45F301

Set $lac = 2191

Set $cellID = 017A

Set $locationData = $network $lac $cellID

 

// Respond to it with a standard successful response and loc.

TerminalResponse_LocationInformation $locationData

 

TerminalResponse_SelectItem <item ID>

Sends the appropriate TERMINAL RESPONSE command APDU to the SIM, where the result TLV indicates a successful execution and resulting Item ID  of the SELECT ITEM proactive command previously fetched.

SIM Commander will automatically ensure the command details and device details TLV objects are correct.

Example Script Code:

// Perform a TERMINAL PROFILE, which should result in a proactive command waiting.

TerminalProfile

 

// Fetch the waiting proactive command (SELECT ITEM)

Fetch

 

// Respond to it selecting item 3

TerminalResponse_SelectItem 3

 

// Alternatively, respond with a backward move by user

TerminalResponse Back

 

UnblockCHV <chv num> <uchv> <new chv>

This command sends an UNBLOCK CHV command APDU to the SIM. The CHV number, UCHV value and new chv value must be specified. Where these values are less than 8 bytes, the command will automatically add trailing 'FF' bytes.

Example Script Code:

// Change PIN1 using standard 4 character values

UnblockCHV 1 0102030405060708 "1234"

 

// Repeat above, but use variables this time

Set $chvNum = 1

Set $uchv = 0102030405060708

Set $newValue = "1234"

UnblockCHV $chvNum $uchv $newValue

 

Unpack <$variable>

This command performs 7-bit unpacking of the specified variable, which is assumed to be a text string. There are scenarios where the actual length of the resulting unpacked string cannot be determined exactly, due to the nature of the packing process. In this scenario, the last character of the unpacked string shall be set to '@'.

Example Script Code:

Set $text = D377BBFC769741E83019447F83E8F23C284D07

 

Unpack $text

// The text is now unpacked.

 

DisplayAsText $text

 

UpdateBinary [<offset>] <data>

Sends an UPDATE BINARY command APDU to the SIM, writing the specified data to the currently selected transparent EF.

If no offset is specified, this command will write from offset 0. If an offset is specified, then the command will write from that offset.

Note: you do not have to update all of the bytes in the EF.

Example Script Code:

// Select EF(LOCI) under the GSM directory

Select 3F00

Select 7F20

Select 6F78

 

// This file has READ policy of CHV1
VerifyCHV 1 "1234"

 

Set $offset = 3

 

// Update all 8 bytes in the EF

UpdateBinary 0102030405060708

 

// Update only the last 5 bytes

UpdateBinary $offset 0405060708

 

// Update only the first 3 bytes

UpdateBinary 010203

 

UpdateRecord <record> | Next | Previous | Current <data>

Sends an UPDATE RECORD command APDU to the SIM, writing the specified data to the currently selected linear-fixed or cyclic EF.

A record number must be specified for absolute mode. Alternatively, the other modes can be specified as shown. Also, the data supplied must match the record length of the EF.

Example Script Code:

// Select EF(ADN) under the TELECOM directory

Select 3F00

Select 7F10

Select 6F3A

 

// This file has READ policy of CHV1
VerifyCHV 1 "1234"

 

Set $data = 0000000000000000000000000000000000000000000000

 

UpdateRecord 5 FFFFFFFFFFFFFFFF0102030405060708090A0B0C0D0E0F

UpdateRecord Previous $data

 

VerifyCHV <chv number> <value>

This command sends a VERIFY CHV command APDU to the SIM. The CHV number and value must be specified. Where the value is less than 8 bytes, the command will automatically add trailing 'FF' bytes.

Example Script Code:

// Verify PIN1 using a standard 4 character value

VerifyCHV 1 "1234"

 

// Repeat above, but use variables this time

Set $chvNum = 1

Set $value = "1234"

VerifyCHV $chvNum $value

 

// Verify ADM4 using a more complex 8 byte hex value

VerifyCHV 8 0102030405060708

 

While <condition> { ... }

Allows creation of looped code, with the loop being terminated when the condition is no longer (if ever) met.

Example Script Code:

Set $count = 1

While ($count < #10)
{
	ReadRecord $count
	Increment $count
}

Select 3F00
 
 
Back to Contents
 
 

Home | Products | Services | Support | Praise | Contact

 

 

© 2001-2007 Quantaq Solutions. All Rights Reserved.