-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathReadMe.txt
More file actions
153 lines (83 loc) · 4 KB
/
ReadMe.txt
File metadata and controls
153 lines (83 loc) · 4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
The PCSC Connector Component for Delphi
The component has the following properties, methods and events:
Methods:
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
Obvious what these do
function Init: boolean;
Init tries to establish a connection with the SmartCard API and to read the
list of installed readers. If the connection is successfull, and a minimum
of one reader is found, TRUE is returned
function Open: boolean;
Open starts watching the selected reader for status changes
procedure Close;
Close cancels all open requests and finishes watching the reader
function Connect: boolean;
Connect tries to connect to the card in the selected reader.
If successful, TRUE is returned
procedure Disconnect;
Disconnect disconnects from the card in the selected reader
function GetResponseFromCard(const apdu: string): string;
function GetResponseFromCard(const command : string;
var data : string;
var sw1, sw2: byte): boolean;
Let you send APDUs to the card. Either provide a complete APDU and get the
resulting APDU as a string, or provide the command (CLA,INS,P1,P2,P3) and DATA and get
SW1, SW2 and DATA as response and TRUE as result if the request was successful
Properties:
property ReaderList: TStringList;
property UseReaderNum: integer;
ReaderList holds the list of available readers. It is filled by calling Init.
UseReaderNum points to the Reader to use in ReaderList or is set to -1
if no reader is selected
property NumReaders: integer;
Holds the number of available readers
property Connected: boolean;
TRUE if connected to the reader (the reader MAY BE empty)
property Opened: boolean;
TRUE if a reader is being watched
property ReaderState: cardinal;
holds the last status of the reader, see WinSCard.pas
property AttrProtocol: integer;
the protocol used to communicate with the current card
property AttrICCType: string;
the ICC type of the current card
property AttrCardATR: string;
the ATR of the current card
property AttrVendorName: string;
the vendor name of the reader
property AttrVendorSerial: string;
the serial number of the reader
Events:
property OnCardInserted : TPCSCCardEvent
fires when a card is inserted in the reader
property OnCardActive : TPCSCCardEvent
fires when a inserted card is recognised and may be accessed.
The Attr-propertys are filled beforehand
property OnCardRemoved : TPCSCCardEvent
fires when a inserted card is removed from the reader
property OnCardInvalid : TPCSCCardEvent
fires when a inserted card is not readable
property OnReaderWaiting : TPCSCReaderEvent
fires when the reader is ready and waiting for a card
property OnReaderListChange : TPCSCReaderEvent
fires when the reader list has been updated
property OnError : TPCSCErrorEvent
TPCSCErrorEvent = procedure(Sender: TObject;
ErrSource: TErrSource;
ErrCode: cardinal)
TErrSource = (esInit, esGetStatus, esConnect, esTransmit);
fires when a error message is received while connecting to the card,
reading the status word or transmitting data to the card
Hints:
--------------------------------------------------------
First, call INIT
Then, set the reader you want to use
Then, call OPEN
or
call OPEN in the On ReaderWaiting Event
Then, if a card is inserted, you may call GetResponse...
--------------------------------------------------------
A error 0x80100002 (The action was cancelled by an SCardCancel request)
is normal behaviour when calling CLOSE
--------------------------------------------------------