Basic Card Tech

Basic Card Tech

Smart Cards - SDK - Smart Card Readers - Smart card programming - Smart card systems

Smart Cards - SDK - Smart Card Readers - Smart card programming - Smart card systems

Obviously, programming a smart card is not the same as programming a desktop computer. It has no keyboard or screen, for a start. So how does a smart card receive its input and communicate its output? It talks to the outside world through its bi-directional I/O contact. Communication takes place at 9600 baud or more, according to the T=0 and T=1 protocols defined in ISO/IEC standards 7816-3 and 7816-4. (The latest cards also implement the contactless ISO14443 protocol.) But this is completely invisible to the Basic programmer – all you have to do is define a command in the card, and program it like an ordinary Basic procedure. Then you can call this command from a ZC-Basic program running on the PC. Again, the command is called as if it was an ordinary procedure.

The BasicCard operating system takes care of all the communications for you. It will even encrypt and decrypt the commands and responds if you ask it to. All you have to do is specify a different two-byte ID for each command that you define. (If you are familiar with ISO/IEC 7816-4:Interindustry commands for interchange, you will know these two bytes as CLA and INS, for Class and Instruction.)

Here is a simple example. Suppose you run a discount warehouse, and you are issuing the BasicCard to members to store pre-paid credits. You will want a command that returns the number of credits left in the card. So you might define the command GetCustomerCredits, and give it an ID of &H20 &H01 (&H is the hexadecimal prefix):

Eeprom CustomerCredits '' Declare a permanent Integer variable

You can call this command from the PC with the following code:

Declare Command &H20 &H01 GetCustomerCredits (Credits)

If Status <> swCommandOK Then GoTo CancelTransaction

The value &H9000 is defined in ISO/IEC 7816-4 as the status code for a successful command. This value is automatically returned to the caller unless the ZC-Basic code specifies otherwise. The return value from a command should always be checked, even if the command itself has no error conditions – for instance, the card may have been removed from the reader.

It’s as simple as that. Of course, there is a lot more going on below the surface, but you don’t have to know about it to write a BasicCard application.

All BasicCard families (Enhanced, Professional, and MultiApplication) contain:

a full implementation of the T=1 block-level communication protocol defined in ISO/IEC 7816-3: Electronic signals and transmission protocols, including chaining, retries, and WTX requests;

a command dispatcher built around the structures defined in ISO/IEC 7816-4: Interindustry commands for interchange (CLA INS P1 P2 [Lc IDATA] [Le] );

built-in commands for loading EEPROM, enabling encryption, etc.;

a Virtual Machine for the execution of ZeitControl’s P-Code;

code for the automatic encryption and decryption of commands and responses, using theAES or DES symmetric-key algorithm;

IEEE-compatible floating-point arithmetic.The functionality of the Enhanced BasicCard family can be further extended using Plug-In Libraries.

Professional BasicCards contain all the above, plus:

a Public-Key algorithm (RSA or EC);

a full implementation of the T=0 byte-level communication protocol defined in ISO/IEC 7816-3: Electronic signals and transmission protocols;

support for extended Lc/Le, allowing commands and responses up to 2048 bytes long (Series 7 Professional BasicCards only);

T=CL Type A contactless protocol, as defined in ISO/IEC 14443: Proximity Cards (Series 7 Professional BasicCards only).The MultiApplication BasicCard (and most Professional BasicCards) contain all the above, plus cryptographic algorithms EAX (for Authenticated Encryption) and OMAC (for Message Authentication) and the SHA-256 Secure Hash Algorithm.

The following text contains details of all currently available BasicCards versions, and the cryptographic algorithms that they support.

The ZeitControl MultiDebugger software support package consists of:

ZCMDTERM and ZCMDCARD, debuggers for Terminal programs and BasicCard programs;

ZCMBASIC, the compiler for the ZC-Basic language;

ZCMSIM, for low-level simulation of Terminal and BasicCard programs;

BCLOAD, for downloading P-Code to the BasicCard;

KEYGEN, a program that generates random keys for use in encryption;

BCKEYS, for downloading cryptographic keys to the Compact and Enhanced BasicCards.

function add_opt(id,name,title,type,opttype,combine){opt[opt.length]=[id,name,title,type,opttype,combine];}

function sfAddPop(name,isLang){if(!isInSF()&&tf.utils){if(!name)name=''pconfirm''; sfAddRef=[];tf.utils.showPopup(tf.wm.url(name+''.html'',tf.lmd[name],isLang),560,200,true,false,false,''AddToBasket'');}}

function sfAddUnpop(){if(tf.utils)tf.utils.sfMediaBox.closeBox();}

var bpriceArr=[],ppriceArr=[],weightArr=[],crFFldArr=[],ppriceCrossPromotionArr=[],bpriceCrossPromotionArr=[];

function ppriceDsp(n){var cc=tf.currentCurrency,dd=cc.decimal_places,cm=cc.multiplier,sm=tf.shopCurrency.multiplier,dec=Math.pow(10,dd),s=''''+(Math.round((n*cm/sm)*dec)/dec),dp=s.indexOf(''.'');if(dp==-1)dp=s.length;else dp++;s+=(s.indexOf(''.'')==-1&&dd>0?''.'':'''')+''00000''.substr(0,dd-(s.length-dp));return s;}

function dBasePrice2(Id,arr,w){if(!arr)return;if(!w)w=window;arr=arr.split(core.str_sep1);if(w.document.getElementById(''ProductBasePrice-''+Id)){var bpriceHTML=core.bprice([Id,arr[4],arr[5],arr[6],arr[2]]);if(bpriceHTML!='''')w.document.getElementById(''ProductBasePrice-''+Id).innerHTML=bpriceHTML;}}

Choose Basic Card for your next project

Plug-In Libraries for the Enhanced BasicCard: EC-161, AES, SHA-1

1 DES with 56 or 112 bit key size only, 168 bit key size is not supported in Enhanced BasicCard

2 T=CL is supported in ZC7.5 Combi or RFID subtype only

IEEE P1363: Standard Specifications for Public Key CryptographyEC-p

Elliptic Curve Cryptography over the field GF(p)

Elliptic Curve Cryptography over the field GF(2211 )

Elliptic Curve Cryptography over the field GF(2167 )

Elliptic Curve Cryptography over the field GF(2168 )

Encryption with Authentication for Transfer (using AES)

EAX: A Conventional Authenticated-Encryption Mode1M. Bellare, P. Rogaway, D. WagnerOMAC

OMAC: One-Key CBC MAC1Tetsu Iwata and Kaoru KurosawaDepartment of Computer and Information Sciences, Ibaraki University4–12–1 Nakanarusawa, Hitachi,Ibaraki 316-8511, JapanAES

Federal Information Processing Standard FIPS 197DES

ANSI X3.92-1981: Data Encryption Algorithm1 These documents are available at Hashing Algorithms

Federal Information Processing Standard FIPS 180-1SHA-1

Secure Hash Algorithm, revision 1Communication Protocols

ISO/IEC 7816-3: Electronic signals and transmission protocolsT=1

Almex SmartCard Products - Burlington - Ontario - Canada

The best store builder by ShopFactory powers D42. All-in one store builder and eCommerce software.