-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathcsc_def.h
433 lines (335 loc) · 13.4 KB
/
csc_def.h
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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
/*****************************************************************
CONSTANTS DEFINES for ASKCSC.DLL ( csc_def.h )
ANSI 'C' Language.
Copyright (C)2002-1999 by ASK SOPHIA ANTIPOLIS FRANCE
All right reserved.
Author : Thierry J. / Serge M. - ASK
*****************************************************************/
/*****************************************************************
HISTORY :
Ver 4.05.03.253 03-09-10 BL Add long frames management
Ver 4.05.03.218 Beta 03-08-06 BL Add mono search mode
Add CTx512x class
Add CSC_WriteSAMNumber command
Add CSC_TransparentCommand and CSC_TransparentCommandConfig
Ver 4.04.03.022 03-01-22 BL
Ver 4.04.02.333 Beta 02-11-19 BL
Ver 4.04.02.332 Alpha02-11-18 BL
Ver 4.03.00.275 02-10-02 BL Correct CSC_SearchCardExt in askcsc.def
Ver 4.02.00.246 02-09-04 BL Add ISOCommandContact()
Add sCARD_SearchExt
Add CSC_SearchCardExt() using sCARD_SearchExt + search_mask
Change VerifyPIN() for clear mode PIN presentation
Add PINStatus()
Add MIFARE_Select()
Ver 4.01.00.133-Beta 02-08-21 BL Add first CTx512B defines : list, select, read, update, halt
Ver 4.00.02.036 02-02-05 SM Add Error code and new class constantes
Ver 3.01.00.329 Beta 00-11-24 JLM Add GEN 3XX Managment
Ver 2.01.00.136 00-05-15 JLM Add GTML defines
Ver 2.01.00.126 00-05-05 JLM Remove GTML_ChangeKey function
Ver 2.01.00.116 00-04-25 THJ Add GTML class
Ver 1.93.00.061 00-03-01 THJ Error CSC_ResetSAM ( vBuf[6] )
Ver 1.92.00.032 00-02-01 THJ Error CSC_ISOCommand ( vBuf[4] )
Ver 1.91.99.322 99-11-12 THJ Send ATR from ISSUER coupler
Ver 1.90.99.301 99-10-22 THJ Correct Increase and Decrease Bug
Ver 1.80.99.257 99-09-09 THJ Modify CSC_CardStopSearch
Ver 1.60.99.242 99-08-25 THJ Special search
Ver 1.50.99.227 99-08-10 THJ Parallel communication
Ver 1.07.99.142 99-05-18 THJ First Commercial Version
Ver 1.05.99.119 99-03-26 THJ Created
*****************************************************************/
#ifndef __CSC_DEF_H__
#define __CSC_DEF_H__
/* DLL Export Function return */
#define RCSC_Ok 0x8001
#define RCSC_OpenCOMError 0x8002
#define RCSC_NoAnswer 0x8003
#define RCSC_CheckSum 0x8004
#define RCSC_Fail 0x8005
#define RCSC_CardNotFound 0x8006
#define RCSC_AntennaFails 0x8007
#define RCSC_Timeout 0x8008
#define RCSC_DataWrong 0x8009
#define RCSC_Overflow 0x800A
#define RCSC_ErrorSAM 0x800B
#define RCSC_CSCNotFound 0x800C
#define RCSC_BadATR 0x800D
#define RCSC_TXError 0x800E
#define RCSC_WarningVersion 0x800F
#define RCSC_SelectSAMError 0x8010
#define RCSC_UnknownClassCommand 0x8011
#define RCSC_InputDataWrong 0x8012
/* search masks for CSC_SearchCardExt function */
#define SEARCH_MASK_CONT 0x0001
#define SEARCH_MASK_ISOB 0x0002
#define SEARCH_MASK_ISOA 0x0004
#define SEARCH_MASK_TICK 0x0008
#define SEARCH_MASK_INNO 0x0010
#define SEARCH_MASK_MIFARE 0x0020
#define SEARCH_MASK_MV4K 0x0040
#define SEARCH_MASK_MV5K 0x0080
#define SEARCH_MASK_MONO 0x0100
/* CSC Protocol value */
#define CSC_CMD_RES 0x01
#define CSC_CMD_STOP 0x02
#define CSC_CMD_EXEC 0x80
#define CSC_STA_ANS 0x01
#define CSC_STA_STOP 0x04
#define CSC_STA_RES 0x10
#define CSC_STA_ERROR 0x80
/* Function class */
#define CSC_CLA_DOWNLOAD 0x00
#define CSC_CLA_SYSTEM 0x01
#define CSC_CLA_GTML 0x02
#define CSC_CLA_CD97 0x03
#define CSC_CLA_CERTIF 0x04
#define CSC_CLA_GEN 0x05
#define CSC_CLA_CTX 0x06
#define CSC_RATP 0x07 // Reserved by Ratp for compatibility
#define CSC_CLA_MIFARE 0x10
/* DOWNLOAD Class Functions */
#define CSC_DOW_START_DOWNLOAD 0x01
#define CSC_DOW_STOP_DOWNLOAD 0x02
#define CSC_DOW_WRITE_FLASH 0x03
#define CSC_DOW_CHANGE 0x04
#define CSC_WRITE_SAM_NUMBER 0x06
/* SYSTEM Class Functions */
#define CSC_SYS_SOFTWARE_VERSION 0x01
#define CSC_SYS_SEARCH_STOP 0x02
#define CSC_SYS_ENTER_HUNT_PHASE 0x03
#define CSC_SYS_END_TAG_COMMUNICATION 0x04
#define CSC_SYS_GET_COMMUNICATION_STATUS 0x05
#define CSC_SYS_SET_APGEN_EXTENSION 0x06
#define CSC_SYS_SET_TAG_COMMUNICATION_PARAMETERS 0x07
//#define CSC_SYS_SET_SAM_COMMUNICATION_PARAMETERS 0x08
#define CSC_SYS_SWITCH_OFF_ANTENNA 0x0E
#define CSC_SYS_SET_ANTENNA_TRANSPARENT_MODE 0x11
#define CSC_SYS_SEND_TO_ANTENNA 0x12
#define CSC_SYS_RESET_SAM 0x13
#define CSC_SYS_SEND_TO_SAM 0x14
#define CSC_SYS_SELECT_CID 0x15
#define CSC_SYS_SELECT_DIV 0x16
#define CSC_SYS_EHP_PARAMS 0x17
//#define CSC_SYS_LOAD_DATA_SAM 0x1A
#define CSC_SYS_SELECT_SAM 0x19
#define CSC_SYS_SWITCH_SIGNALS 0x18
#define CSC_TRANSP_COMMAND_CONFIG 0x20
#define CSC_TRANSP_COMMAND_SEND 0x21
/* Antenna Type */
#define CSC_SYS_ANTENNA_1 0x00
#define CSC_SYS_ANTENNA_2 0x01
#define CSC_SYS_ANTENNA_3 0x02
#define CSC_SYS_ANTENNA_4 0x03
#define CSC_SYS_ANTENNA_1_2 0x81
#define CSC_SYS_ANTENNA_1_2_3 0x82
#define CSC_SYS_ANTENNA_1_2_3_4 0x83
#define CSC_SYS_ANTENNA_1_MONO 0x40
#define CSC_SYS_ANTENNA_2_MONO 0x41
#define CSC_SYS_ANTENNA_3_MONO 0x42
#define CSC_SYS_ANTENNA_4_MONO 0x43
#define CSC_SYS_ANTENNA_1_2_MONO 0xC1
#define CSC_SYS_ANTENNA_1_2_3_MONO 0xC2
#define CSC_SYS_ANTENNA_1_2_3_4_MONO 0xC3
/* communication badge */
#define CSC_SYS_TAG_NO_DATA_RECEIVED 0x00
#define CSC_SYS_TAG_DATA_RECEIVED 0x01
#define CSC_SYS_TAG_DATA_ERROR 0xFF
#define CSC_SYS_TAG_FRAMING_ERROR 0xFE
#define CSC_SYS_TAG_OVERFLOW_ERROR 0xFD
#define CSC_SYS_TAG_TIME_OUT_DATA 0xFC
#define CSC_SYS_TAG_CRC_ERROR 0xFB
#define CSC_SYS_GDW8 0x01
#define CSC_SYS_BPSK_TELEALIM 0x03
/* Search Type */
#define CSC_SEARCH_PSCL CSC_SYS_GDW8
#define CSC_SEARCH_CLESSCARD CSC_SYS_BPSK_TELEALIM
/* SetAPGEN Extentions */
#define CSC_SYS_ATR 0x80
#define CSC_SYS_NO_ATR 0x00
/* modes transparents */
#define CSC_SYS_MODE_TRANSPARENT_1 0x00
#define CSC_SYS_MODE_TRANSPARENT_2 0x01
#define CSC_SYS_MODE_TRANSPARENT_ETENDU 0x02
/* SAMs */
#define CSC_SYS_SAM_CD97 0x00
#define CSC_SYS_SAM_CD96 0x01
#define CSC_SAM_105937 0x00
#define CSC_SAM_423750 0x01
#define CSC_SAM_84750 0x02
/* deconnexion */
#define CSC_SYS_DISC_REQ 0x01
#define CSC_SYS_NO_DISC_REQ 0x00
/* LED & Buzzer Parameters */
#define CSC_CPU_LED1 0x0100
#define CSC_CPU_LED2 0x0200
#define CSC_CPU_LED3 0x0400
#define CSC_ANT_BUZZER 0x0001
#define CSC_ANT_LED1 0x0002
#define CSC_ANT_LED2 0x0000
/*-------------------- CD97 Defines -------------------*/
/* Access mode */
#define CD97_ACCESS_MODE_DEFAULT 0
#define CD97_ACCESS_MODE_PROTECTED 1
#define CD97_ACCESS_MODE_STAMPED 2
#define CD97_ACCESS_MODE_PIN 3
/* CD97 Class Functions */
#define CSC_CD97_APPEND_RECORD 0x01
#define CSC_CD97_CHANGE_KEY 0x02
#define CSC_CD97_DECREASE 0x03
#define CSC_CD97_INCREASE 0x04
#define CSC_CD97_INVALIDATE 0x05
#define CSC_CD97_READ_RECORD 0x06
#define CSC_CD97_REHABILITATE 0x07
#define CSC_CD97_SELECT_FILE 0x08
#define CSC_CD97_STATUS 0x09
#define CSC_CD97_UPDATE_RECORD 0x0A
#define CSC_CD97_VERIFY_PIN 0x0B
#define CSC_CD97_WRITE_RECORD 0x0C
#define CSC_CD97_PURCHASE 0x0D
#define CSC_CD97_GET_EP_STATUS 0x0E
#define CSC_CD97_RELOAD_EP 0x0F
#define CSC_CD97_OPEN_SECURED_SESSION 0x10
#define CSC_CD97_CLOSE_SECURED_SESSION 0x11
#define CSC_CD97_ABORT_SECURED_SESSION 0x12
#define CSC_CD97_CANCEL_PURCHASE 0x13
/* Small ID file number */
#define CD97_SID_CURENT_EF 0x00
#define CD97_SID_CURRENT_EF 0x00
#define CD97_SID_MF_ICC 0x02
#define CD97_SID_MF_ID 0x03
#define CD97_SID_MF_AFFICHAGES 0x05
#define CD97_SID_PME_JOURNAL_CHARGEMENTS 0x14
#define CD97_SID_PME_JOURNAL_ACHATS 0x15
#define CD97_SID_RT_ENVIRONNEMENT_TITULAIRE 0x07
#define CD97_SID_RT_JOURNAL 0x08
#define CD97_SID_RT_CONTRATS 0x09
#define CD97_SID_RT_COMPTEUR_CONTRAT_1 0x0A
#define CD97_SID_RT_COMPTEUR_CONTRAT_2 0x0B
#define CD97_SID_RT_COMPTEUR_CONTRAT_3 0x0C
#define CD97_SID_RT_COMPTEUR_CONTRAT_4 0x0D
#define CD97_SID_RT_MEMOIRE_OD 0x06
#define CD97_SID_RT_EVENEMENT_SPECIAUX 0x1D
#define CD97_SID_RT_COMPORTEMENT_FIDELITE 0x1E
/* Select Mode */
#define CD97_SEL_MF 0x00
#define CD97_SEL_CURENT_EF 0x02
#define CD97_SEL_CURRENT_EF 0x02
#define CD97_SEL_PATH 0x08
#define CD97_FILE_SIZE 29
/*-------------------- GTML Defines -------------------*/
/* Access mode */
#define GTML_ACCESS_MODE_DEFAULT 0
/* Small ID file number */
#define GTML_SID_CURRENT_EF 0x00
#define GTML_SID_MF_ICC 0x02
#define GTML_SID_MF_ID 0x03
#define GTML_SID_RT_ENVIRONMENT 0x07
#define GTML_SID_RT_EVENTS_LOG 0x08
#define GTML_SID_RT_CONTRACTS 0x09
#define GTML_SID_RT_COUNTER_1 0x0A
#define GTML_SID_RT_COUNTER_2 0x0B
#define GTML_SID_RT_COUNTER_3 0x0C
#define GTML_SID_RT_COUNTER_4 0x0D
#define GTML_SID_RT_COUNTER_5 0x0E
#define GTML_SID_RT_COUNTER_6 0x0F
#define GTML_SID_RT_COUNTER_7 0x10
#define GTML_SID_RT_COUNTER_8 0x11
#define GTML_SID_RT_COUNTER_9 0x12
#define GTML_SID_RT_ALL_COUNTERS 0x19
#define GTML_SID_RT_OD_MEMORY 0x06
#define GTML_SID_RT_SPECIAL_EVENT 0x1D
/* Select Mode */
#define GTML_SEL_MF 0x00
#define GTML_SEL_CURRENT_EF 0x02
#define GTML_SEL_PATH 0x08
/*-------------------- Generic Defines -------------------*/
/* Access mode */
#define GEN_ACCESS_MODE_DEFAULT 0
#define GEN_ACCESS_MODE_PROTECTED 1
#define GEN_ACCESS_MODE_STAMPED 2
#define GEN_ACCESS_MODE_PIN 3
/* Generic Class Functions */
#define CSC_GEN_APPEND_RECORD 0x01
#define CSC_GEN_CHANGE_PIN 0x02
#define CSC_GEN_DECREASE 0x03
#define CSC_GEN_INCREASE 0x04
#define CSC_GEN_INVALIDATE 0x05
#define CSC_GEN_READ_RECORD 0x06
#define CSC_GEN_REHABILITATE 0x07
#define CSC_GEN_SELECT_FILE 0x08
#define CSC_GEN_STATUS 0x09
#define CSC_GEN_UPDATE_RECORD 0x0A
#define CSC_GEN_VERIFY_PIN 0x0B
#define CSC_GEN_WRITE_RECORD 0x0C
#define CSC_GEN_PURCHASE 0x0D
#define CSC_GEN_GET_EP_STATUS 0x0E
#define CSC_GEN_RELOAD_EP 0x0F
#define CSC_GEN_OPEN_SECURED_SESSION 0x10
#define CSC_GEN_CLOSE_SECURED_SESSION 0x11
#define CSC_GEN_ABORT_SECURED_SESSION 0x12
#define CSC_GEN_CANCEL_PURCHASE 0x13
#define CSC_GEN_DECREASE_MULTIPLE 0x14
#define CSC_GEN_INCREASE_MULTIPLE 0x15
#define CSC_GEN_LOCK_UNLOCK 0x16
/* Select Mode */
#define GEN_SEL_MF 0x00
#define GEN_SEL_CURENT_EF 0x02
#define GEN_SEL_CURRENT_EF 0x02
#define GEN_SEL_PATH 0x08
/* Session Type */
#define SESSION_LEVEL_PERSO 0x00
#define SESSION_LEVEL_RELOAD 0x01
#define SESSION_LEVEL_VALID 0x02
/*-------------------- CTx Defines -------------------*/
/* CTx Class Functions */
#define CSC_CTX_ACTIVE 0x01
#define CSC_CTX_READ 0x02
#define CSC_CTX_UPDATE 0x03
#define CSC_CTX_RELEASE 0x04
/*-------------------- CTx512B Defines -------------------*/
/* CTx512B Class Functions */
#define CSC_CTX_512B_LIST 0x20
#define CSC_CTX_512B_SELECT 0x21
#define CSC_CTX_512B_READ 0x22
#define CSC_CTX_512B_UPDATE 0x23
#define CSC_CTX_512B_HALT 0x24
/*-------------------- CTx512x Defines -------------------*/
/* CTx512x Class Functions */
#define CSC_CTX_512X_LIST 0x20
#define CSC_CTX_512X_SELECT 0x21
#define CSC_CTX_512X_READ 0x22
#define CSC_CTX_512X_UPDATE 0x23
#define CSC_CTX_512X_HALT 0x24
#define CSC_CTX_512X_WRITE 0x26
#define CSC_CTX_512X_AUTHENTICATE 0x27
#define CSC_CTX_512X_WRITEKEY 0x28
/*----------------- Certificat Defines ----------------*/
#define CSC_CheckCertificat 0x04
#define CSC_GiveCertificat 0x05
/*----------------- SAM Defines -----------------------*/
#define SAM_SLOT_0 0x00
#define SAM_SLOT_1 0x01
#define SAM_SLOT_2 0x02
#define SAM_SLOT_3 0x03
#define SAM_SLOT_4 0x04
#define SAM_CURRENT 0x00
#define CONTACT_SLOT 0x04
#define SAM_PROT_HSP_INNOVATRON 0x00
#define SAM_PROT_ISO_7816 0x01
/*----------------- MIFARE Defines --------------------*/
#define CSC_INS_RC500 0x01
#define CSC_MIFARE_LOADKEY 0x06 //SUB Command
#define CSC_MIFARE_CHANGEKEY 0x03
#define CSC_MIFARE_SELECT 0x02
#define CSC_MIFARE_AUTHENTICATE 0x05
#define CSC_MIFARE_READBLOCK 0x06
#define CSC_MIFARE_READSECTOR 0x07
#define CSC_MIFARE_WRITEBLOCK 0x08
#define CSC_MIFARE_HALT 0x09
#define CSC_MIFARE_INCREMENT 0x0A
#define CSC_MIFARE_DECREMENT 0x0B
#define CSC_MIFARE_BACKUPRESTORE 0x0C
/*----------------- STOP SEARCH COMMAND ---------------*/
#define INTERROGATION 0
#define DEFINITIVELY 1
#endif /* __CSC_DEF_H__ */