root/trunk/src/libopensc/ctbcs.h

Revision 2354, 6.5 KB (checked in by aj, 3 years ago)

"smart card" not "smartcard" or "SmartCard?".

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1/*
2    CT-BCS commands, responses and parameters for terminals
3    without keypad and display.
4
5    This file is part of the Unix driver for Towitoko smart card readers
6    Copyright (C) 1998 1999 2000 Carlos Prados <cprados@yahoo.com>
7
8    This library is free software; you can redistribute it and/or
9    modify it under the terms of the GNU Lesser General Public
10    License as published by the Free Software Foundation; either
11    version 2 of the License, or (at your option) any later version.
12
13    This library is distributed in the hope that it will be useful,
14    but WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16    Lesser General Public License for more details.
17
18    You should have received a copy of the GNU Lesser General Public
19    License along with this library; if not, write to the Free Software
20    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
21*/
22
23#ifndef _CTBCS_
24#define _CTBCS_
25
26/*
27 * Command and response size
28 */
29#define CTBCS_MIN_COMMAND_SIZE          2
30#define CTBCS_MIN_RESPONSE_SIZE         2
31
32/*
33 * Class byte of all CTBCS commands
34 */
35#define CTBCS_CLA                       0x20
36
37/*
38 * Mandatory CT-BCS commands
39 */
40#define CTBCS_INS_RESET                 0x11    /* Reset CT */
41#define CTBCS_INS_REQUEST               0x12    /* Request ICC */
42#define CTBCS_INS_STATUS                0x13    /* Get reader status */
43#define CTBCS_INS_EJECT                 0x15    /* Eject ICC */
44
45/*
46 * Additional CT-BCS commands
47 */
48#define CTBCS_INS_INPUT                 0x16    /* Input from pin pad */
49#define CTBCS_INS_OUTPUT                0x17    /* Output to pad pad display */
50#define CTBCS_INS_PERFORM_VERIFICATION  0x18    /* Verify PIN from pin pad */
51#define CTBCS_INS_MODIFY_VERIFICATION   0x19    /* Perform a change/unblock PIN op */
52
53/*
54 * P1 parameter: functional units
55 */
56
57#define CTBCS_P1_CT_KERNEL              0x00
58#define CTBCS_P1_INTERFACE1             0x01
59#define CTBCS_P1_INTERFACE2             0x02
60#define CTBCS_P1_INTERFACE3             0x03
61#define CTBCS_P1_INTERFACE4             0x04
62#define CTBCS_P1_INTERFACE5             0x05
63#define CTBCS_P1_INTERFACE6             0x06
64#define CTBCS_P1_INTERFACE7             0x07
65#define CTBCS_P1_INTERFACE8             0x08
66#define CTBCS_P1_INTERFACE9             0x09
67#define CTBCS_P1_INTERFACE10            0x0A
68#define CTBCS_P1_INTERFACE11            0x0B
69#define CTBCS_P1_INTERFACE12            0x0C
70#define CTBCS_P1_INTERFACE13            0x0D
71#define CTBCS_P1_INTERFACE14            0x0E
72#define CTBCS_P1_DISPLAY                0x40
73#define CTBCS_P1_KEYPAD                 0x50
74#define CTBCS_P1_PRINTER                0x60 /* New CT-BCS 1.0 */
75#define CTBCS_P1_FINGERPRINT            0x70 /* New CT-BCS 1.0 */
76#define CTBCS_P1_VOICEPRINT             0x71 /* New CT-BCS 1.0 */
77#define CTBCS_P1_DSV                    0x72 /* "Dynamic Signature Verification" New CT-BCS 1.0 */
78#define CTBCS_P1_FACE_RECOGNITION       0x73 /* New CT-BCS 1.0 */
79#define CTBCS_P1_IRISSCAN               0x74 /* New CT-BCS 1.0 */
80/* Other biometric units may use values up to 0x7F */
81
82/*
83 * P2 parameter for Reset CT: data to be returned
84 */
85#define CTBCS_P2_RESET_NO_RESP          0x00    /* Return no data */
86#define CTBCS_P2_RESET_GET_ATR          0x01    /* Return complete ATR */
87#define CTBCS_P2_RESET_GET_HIST         0x02    /* Return historical bytes */
88
89/*
90 * P2 parameter for Request ICC: data to be returned
91 */
92#define CTBCS_P2_REQUEST_NO_RESP        0x00    /* Return no data */
93#define CTBCS_P2_REQUEST_GET_ATR        0x01    /* Return complete ATR */
94#define CTBCS_P2_REQUEST_GET_HIST       0x02    /* Return historical bytes */
95
96/*
97 * P2 parameter for Get status: TAG of data object to return
98 */
99#define CTBCS_P2_STATUS_MANUFACTURER    0x46    /* Return manufacturer DO */
100#define CTBCS_P2_STATUS_ICC             0x80    /* Return ICC DO */
101#define CTBCS_P2_STATUS_TFU             0x81    /* Return Functional Units, new in Version 1.0 */
102
103/*
104 * P2 parameter for Input
105 */
106#define CTBCS_P2_INPUT_ECHO             0x01    /* Echo input on display */
107#define CTBCS_P2_INPUT_ASTERISKS        0x02    /* Echo input as asterisks */
108
109/*
110 * Tags for paramaters to input, output et al.
111 */
112#define CTBCS_TAG_PROMPT                0x50
113#define CTBCS_TAG_VERIFY_CMD            0x52
114#define CTBCS_TAG_TIMEOUT               0x80
115
116/*
117 * PIN command control flags
118 */
119#define CTBCS_PIN_CONTROL_LEN_SHIFT     4
120#define CTBCS_PIN_CONTROL_LEN_MASK      0x0F
121#define CTBCS_PIN_CONTROL_ENCODE_ASCII  0x01
122
123/*
124 * General return codes
125 */
126#define CTBCS_SW1_OK                    0x90    /* Command successful */
127#define CTBCS_SW2_OK                    0x00
128#define CTBCS_SW1_WRONG_LENGTH          0x67    /* Wrong length */
129#define CTBCS_SW2_WRONG_LENGTH          0x00
130#define CTBCS_SW1_COMMAND_NOT_ALLOWED   0x69    /* Command not allowed */
131#define CTBCS_SW2_COMMAND_NOT_ALLOWED   0x00
132#define CTBCS_SW1_WRONG_PARAM           0x6A    /* Wrong parameters P1, P2 */
133#define CTBCS_SW2_WRONG_PARAM           0x00
134#define CTBCS_SW1_WRONG_INS             0x6D    /* Wrong Instruction */
135#define CTBCS_SW2_WRONG_INS             0x00
136#define CTBCS_SW1_WRONG_CLA             0x6E    /* Class not supported */
137#define CTBCS_SW2_WRONG_CLA             0x00
138#define CTBCS_SW1_ICC_ERROR             0x6F    /* ICC removed, defective or */
139#define CTBCS_SW2_ICC_ERROR             0x00    /* no longer reacts */
140
141/*
142 * Return codes for Reset CT
143 */
144#define CTBCS_SW1_RESET_CT_OK           0x90    /* Reset CT successful */
145#define CTBCS_SW2_RESET_CT_OK           0x00
146#define CTBCS_SW1_RESET_SYNC_OK         0x90    /* Synchoronous ICC, */
147#define CTBCS_SW2_RESET_SYNC_OK         0x00    /* reset successful */
148#define CTBCS_SW1_RESET_ASYNC_OK        0x90    /* Asynchoronous ICC, */
149#define CTBCS_SW2_RESET_ASYNC_OK        0x01    /* reset successful */
150#define CTBCS_SW1_RESET_ERROR           0x64    /* Reset not successful */
151#define CTBCS_SW2_RESET_ERROR           0x00
152
153/*
154 * Return codes for Request ICC
155 */
156#define CTBCS_SW1_REQUEST_SYNC_OK       0x90    /* Synchoronous ICC, */
157#define CTBCS_SW2_REQUEST_SYNC_OK       0x00    /* reset successful */
158#define CTBCS_SW1_REQUEST_ASYNC_OK      0x90    /* Asynchoronous ICC, */
159#define CTBCS_SW2_REQUEST_ASYNC_OK      0x01    /* reset successful */
160#define CTBCS_SW1_REQUEST_NO_CARD       0x62    /* No card present */
161#define CTBCS_SW2_REQUEST_NO_CARD       0x00
162#define CTBCS_SW1_REQUEST_CARD_PRESENT  0x62    /* Card already present */
163#define CTBCS_SW2_REQUEST_CARD_PRESENT  0x01
164#define CTBCS_SW1_REQUEST_ERROR         0x64    /* Reset not successful */
165#define CTBCS_SW2_REQUEST_ERROR         0x00
166#define CTBCS_SW1_REQUEST_TIMER_ERROR   0x69    /* Timer not supported */
167#define CTBCS_SW2_REQUEST_TIMER_ERROR   0x00
168
169/*
170 * Return codes for Eject ICC
171 */
172#define CTBCS_SW1_EJECT_OK              0x90    /* Command succesful, */
173#define CTBCS_SW2_EJECT_OK              0x00
174#define CTBCS_SW1_EJECT_REMOVED         0x90    /* Command succesful, */
175#define CTBCS_SW2_EJECT_REMOVED         0x01    /* Card removed */
176#define CTBCS_SW1_EJECT_NOT_REMOVED     0x62    /* Card not removed */
177#define CTBCS_SW2_EJECT_NOT_REMOVED     0x00
178
179/*
180 * Data returned on Get Status command
181 */
182#define CTBCS_DATA_STATUS_NOCARD        0x00    /* No card present */
183#define CTBCS_DATA_STATUS_CARD          0x01    /* Card present */
184#define CTBCS_DATA_STATUS_CARD_CONNECT  0x05    /* Card present */
185
186/*
187 * Functions for building CTBCS commands
188 */
189int ctbcs_pin_cmd(struct sc_reader *, sc_slot_info_t *, struct sc_pin_cmd_data *);
190
191#endif /* _CTBCS_ */
Note: See TracBrowser for help on using the browser.