sc

The sc:: Tcl package is a collection of smart card utility commands that apply to any smart card and help in building input to and in processing output from smart cards.

Smart Card Utility Commands

Function

Description

Tcl Usage

Args

Attach Card

Attaches the named smart card to Tcl

sc::attachCard

name - name of the smart card to be attached to Tcl

Command APDU

Sends a raw ISO-7816-4 APDU to the card

sc::APDU

cla - class of the command

ins - instruction of the command

p1 - P1 parameter

p2 - P2 parameter

p3 - P3 parameter

data - data block to be sent

le - Le, expected # of reply bytes

varLr - variable to hold actual # of bytes

varReply - variable to hold reply bytes

varSW - varible to hold status word

DES

DES encrypt a 8-byte block with a 8-byte key

sc::des

key - 8-byte key

block - 8-byte block to be encrypted

varCrypt - variable to hold the encryption

Detach Card

Disconnects the current smart card from Tcl

sc::detachCard

 

Get ATR

Get the Answer To Reset from the current card

sc::ATR

varATR - variable to hold the ATR

Get Lr

Get the length of the last reply from the card

sc::Lr

varLr - variable to hold the length of the last reply

Get Reply

Get the date comprising the last reply from the card

sc::Reply

varReply - variable to hold the data in the last reply

Get SW

Get the status word from the last command

sc::SW

 varSW - variable to hold returned status word

XOR

xor two data blocks

sc::xor

block1 - first block

block 2 - second block

varBlock - varible to hold xor of block1 and block2