Transcript Document

DebitCard Application with ZeitControl BasicCard
Selim GULLULU 504042001
[email protected]
Contents
>
Memory Card vs. Smart Card (ZC BasicCard)
>
BC Versions + Environment&Programming
>
Hardware & Software Definitions
>
Demonstration - Card Personalisation
>
Demonstration – Food Automat
DebitCard Application with ZeitControl Basiccard
20/12/2005—2
Selim GULLULU 504042001
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
DebitCard Application with ZeitControl Basiccard
20/12/2005—3
Selim GULLULU 504042001
BasicCard Versions
The Card Used In
The Project
DebitCard Application with ZeitControl Basiccard
20/12/2005—4
Selim GULLULU 504042001
Communicating With Smart Card
DebitCard Application with ZeitControl Basiccard
20/12/2005—5
Selim GULLULU 504042001
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
DebitCard Application with ZeitControl Basiccard
20/12/2005—6
Selim GULLULU 504042001
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
DebitCard Application with ZeitControl Basiccard
20/12/2005—7
Selim GULLULU 504042001
Defining EEPROM Variables
>
Eeprom Balance As Long
>
Eeprom MasterPIN As String*6 = "123456“
>
...
DebitCard Application with ZeitControl Basiccard
20/12/2005—8
Selim GULLULU 504042001
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
DebitCard Application with ZeitControl Basiccard
20/12/2005—9
Selim GULLULU 504042001
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
DebitCard Application with ZeitControl Basiccard
20/12/2005—10
Selim GULLULU 504042001
Card Readers
>
Whenever you access a BasicCard or a Card Reader from a
ZC-Basic Terminal Program, ZeitControl’s P-Code Interpreter
uses the current value of the ComPort variable to determines
where to look for the Card 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
DebitCard Application with ZeitControl Basiccard
20/12/2005—11
Selim GULLULU 504042001
CyberMouse
DebitCard Application with ZeitControl Basiccard
20/12/2005—12
Selim GULLULU 504042001
Search Card Reader (1)
DebitCard Application with ZeitControl Basiccard
20/12/2005—13
Selim GULLULU 504042001
Search Card Reader (2)
The Comport
To be used
DebitCard Application with ZeitControl Basiccard
20/12/2005—14
Selim GULLULU 504042001
Search Card Reader (3)
Use “API select Default Reader” for Windows XP
DebitCard Application with ZeitControl Basiccard
20/12/2005—15
Selim GULLULU 504042001
ZC BasicCard ActiveX Control Module
DebitCard Application with ZeitControl Basiccard
20/12/2005—16
Selim GULLULU 504042001
BasicCard VB library
DebitCard Application with ZeitControl Basiccard
20/12/2005—17
Selim GULLULU 504042001
Command Definitions Ex. – Set Values (in PC)
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
DebitCard Application with ZeitControl Basiccard
20/12/2005—18
Selim GULLULU 504042001
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
DebitCard Application with ZeitControl Basiccard
20/12/2005—19
Selim GULLULU 504042001
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
DebitCard Application with ZeitControl Basiccard
20/12/2005—20
Selim GULLULU 504042001
Compiling the ZCBasic Code
Here, the card type we used is
selected.
The code that we want to compile
DebitCard Application with ZeitControl Basiccard
20/12/2005—21
Selim GULLULU 504042001
Downloading The Code To BasicCard
The Com Port taht we attached the
reader (Search card Reader)
DebitCard Application with ZeitControl Basiccard
20/12/2005—22
Selim GULLULU 504042001
Demonstration (Personalisation & Food Automat)
DebitCard Application with ZeitControl Basiccard
20/12/2005—23
Selim GULLULU 504042001