230 likes | 425 Views
DebitCard Application with ZeitControl BasicCard. Selim GULLULU 504042001 selim.gullulu@alcatel.com.tr. Contents. Memory Card vs. Smart Card (ZC BasicCard) BC Versions + Environment&Programming Hardware & Software Definitions Demonstration - Card Personalisation
E N D
DebitCard Application with ZeitControl BasicCard Selim GULLULU 504042001 selim.gullulu@alcatel.com.tr
Contents • Memory Card vs. Smart Card (ZC BasicCard) • BC Versions + Environment&Programming • Hardware & Software Definitions • Demonstration - Card Personalisation • Demonstration – Food Automat
Memory Card vs. Smart Card (ZC BasicCard) • Memory Cards:EEPROM Storage Only • ZC BasicCard : Microcontroller with RAM (for operation), ROM (for holding BasicCard OS) and EEPROM for holding your data and your program • ZC BasicCard : The program executed by the microcontroller has access to the data stored in EEPROM, so the program decides which data is exchanged with the outer world
The Card Used In The Project BasicCard Versions
BasicCard Environment & Programming • No Keyboard or Screen ? • Talks to outside world with bi-directional I/O Contact at 9600 bps or more (ISO/IEC standards 7816-3 and 7816-4) • Define a command in the card and program it like an ordinary Basic procedure • Call the command from a ZC-Basic program running on the PC • Two-byte ID for each defined command (ISO/IEC 7816-4: CLA and INS for CLAss and INStruction
Command Example • Command In BasicCard: Eeprom CustomerCredits Command &H20 &H02 GetCustomerCredits (Credits) Credits = CustomerCredits End Command • To call the command from PC: Const swCommandOK = &H9000 Declare Command &H20 &H02 GetCustomerCredits (Credits) Status = GetCustomerCredits (Credits) If Status <> swCommandOK Then GoTo CancelTransaction
Defining EEPROM Variables • Eeprom Balance As Long • Eeprom MasterPIN As String*6 = "123456“ • ...
Technical Summary Of BasicCard(s) All BasicCard families (Compact,Enhanced,Pro,Multiapp) • A full implementation of the T=1 block-level communications protocol defined in ISO/IEC 7816-3: Electronic signals and transmission protocols; • A command dispatcher built around the structures defined in ISO/IEC 7816-4 (CLA INS P1 P2 [LcIDATA] [Le] • Built-in commands for the execution of ZeitControl’s P-code • Code for the automatic encyrption and decyption of commands and responses,using AES, DES,or SG-LFSR symmetric-key algorithm
Technical Summary Of BasicCard(s) (Continued) Enhanced BasicCards contain all of the above,plus: • A directory-based, dos-like file system • IEEE-compatible floating-point arithmetic
Card Readers • Whenever you access a BasicCard or a Card Reader from a ZC-Basic Terminal Program, ZeitControl’sP-Code Interpreter uses the current value of the ComPort variable to determines where to look for theCard Reader. • A ZC-Basic program compiled into an executable file accepts the following values for the ComPort: 1 <= ComPort <= 4:Physical Card Reader on serial port COM1-COM4
The Comport To be used Search Card Reader (2)
Search Card Reader (3) Use “API select Default Reader” for Windows XP
Private Sub SetValues_Click() Dim PIN As String * 4 Dim tmp As Long PIN = PIN1.Text ErrorMsg.Panels(1).Text = "Verifing..." DoEvents MyCard.Err = MyCard.IssuerEncrypt(Key, DesKey) If MyCard.Err = 0 Then tmp = Balance.Text * 100 MyCard.Err = MyCard.PersonaliseCard(tmp, PIN, ClientName.Text) End If If MyCard.Err = 0 Then ErrorMsg.Panels(1).Text = "Personalization successful." Else ErrorMsg.Panels(1).Text = DebitErrors(0) End If MyCard.EndEncryption MyCard.ReleaseCard End Sub Command Definitions Ex. – Set Values (in PC)
Command Definitions Ex – Set Values (Cont’d) (in PC) Public Function PersonaliseCard(Amount As Long, _ NewPIN As String, Name As String) Dim tmp As String * 4 tmp = NewPIN BasicCard.Param1 = Amount BasicCard.Param2 = tmp BasicCard.Param3 = Name PersonaliseCard = BasicCard.Transaction(&H80, &H0, 3) Err = BasicCard.LastErr SW1SW2 = BasicCard.SW1SW2
Command Definitions Ex. – Set Values (Cont’d) ( BC) Command &H80 &H00 PersonaliseCard (Amount As Long, NewPIN As String*4, Name$) Call CheckAlgorithm() If GetKeyNumber@() <> 0 Then SW1SW2 = swIssuingKeyRequired : Exit Personalised = False Balance = Amount CustomerName$ = Name$ PIN = NewPIN Personalised = True End Command
Here, the card type we used is selected. The code that we want to compile Compiling the ZCBasic Code
The Com Port taht we attached the reader (Search card Reader) Downloading The Code To BasicCard