smartcard 0.5.4 → 0.5.5

Sign up to get free protection for your applications and to get access to all the features.
data/BUILD CHANGED
@@ -75,3 +75,13 @@ Ubuntu (tested on 8.04, 8.10, 9.04 and 9.10):
75
75
  * libpcsclite-dev (depends on libpcsclite or libpcsclite1)
76
76
  * pcscd
77
77
  * pcsc-tools
78
+
79
+ === Fedora
80
+
81
+ The following packages should do the trick on Fedora (tested on 18):
82
+ * ruby-devel
83
+ * pcsc-lite
84
+ * pcsc-lite-ccid
85
+ * pcsc-lite-devel
86
+ * pcsc-lite-openct
87
+ * pcsc-tools
data/CHANGELOG CHANGED
@@ -1,3 +1,5 @@
1
+ v0.5.5. Fixed crash in MRI 1.9.3.
2
+
1
3
  v0.5.4. Fixed ReaderStateQuery to work when the status has bits not defined in the PCSC header.
2
4
 
3
5
  v0.5.3. Fixed buggy protocol number decoding logic.
@@ -38,7 +40,7 @@ v0.3.1. Fixed documentation for the new PcscException class.
38
40
 
39
41
  v0.3.0. Added PcscException class used to wrap PC/SC exceptions.
40
42
 
41
- v0.2.3. Fixed minor bug in error string for PCSC::Card.transmit
43
+ v0.2.3. Fixed minor bug in error string for PCSC::Card.transmit
42
44
 
43
45
  v0.2.2. Fixed APDU exchange bugs on Windows
44
46
  Restructured PCSC::IoRequest to allow PCI_ consts
@@ -51,7 +53,7 @@ v0.2.1. Added OSX Tiger support
51
53
 
52
54
  v0.2.0. Added automatic builds
53
55
  Rakefile for auto builds using echoe
54
- extconf.rb: hack to fix Windows makefiles
56
+ extconf.rb: hack to fix Windows makefiles
55
57
 
56
58
  v0.1.2. Added Windows compatibility
57
59
  *.c: restructured code so VC2005 likes it
data/Rakefile CHANGED
@@ -1,26 +1,26 @@
1
1
  require 'rubygems'
2
2
  require 'echoe'
3
3
 
4
- require './tasks/ffi_codegen.rb'
4
+ require './tasks/ffi_codegen.rb'
5
5
 
6
6
  Echoe.new('smartcard') do |p|
7
7
  p.project = 'smartcard' # rubyforge project
8
-
8
+
9
9
  p.author = 'Victor Costan'
10
10
  p.email = 'victor@costan.us'
11
11
  p.summary = 'Interface with ISO 7816 smart cards.'
12
12
  p.url = 'http://www.costan.us/smartcard'
13
- p.dependencies = ['ffi >=0.5.3',
14
- 'rubyzip >=0.9.1',
15
- 'zerg_support >=0.1.5']
16
- p.development_dependencies = ['echoe >=3.2',
17
- 'flexmock >=0.8.6']
18
-
13
+ p.dependencies = ['ffi >=1.2.0',
14
+ 'rubyzip >=0.9.9',
15
+ 'zerg_support >=0.1.6']
16
+ p.development_dependencies = ['echoe >=4.6.3',
17
+ 'flexmock >=1.2.0']
18
+
19
19
  p.need_tar_gz = !Gem.win_platform?
20
20
  p.need_zip = !Gem.win_platform?
21
21
  p.clean_pattern += ['ext/**/*.manifest', 'ext/**/*_autogen.h']
22
22
  p.rdoc_pattern =
23
- /^(lib|bin|tasks|ext)|^BUILD|^README|^CHANGELOG|^TODO|^LICENSE|^COPYING$/
23
+ /^(lib|bin|tasks|ext)|^BUILD|^README|^CHANGELOG|^TODO|^LICENSE|^COPYING$/
24
24
  end
25
25
 
26
26
  file 'lib/smartcard/pcsc/ffi_autogen.rb' => 'tasks/ffi_codegen.rb' do
@@ -8,8 +8,8 @@ require 'set'
8
8
 
9
9
  # :nodoc: namespace
10
10
  module Smartcard::PCSC
11
-
12
-
11
+
12
+
13
13
  # Connects a smart-card in a PC/SC reader to the Ruby world.
14
14
  class Card
15
15
  # Establishes a connection to the card in a PC/SC reader.
@@ -19,10 +19,10 @@ class Card
19
19
  # Args:
20
20
  # context:: the Smartcard::PCSC::Context for the PC/SC resource manager
21
21
  # reader_name:: friendly name of the reader to connect to; reader names can
22
- # be obtained from Smartcard::PCSC::Context#readers
22
+ # be obtained from Smartcard::PCSC::Context#readers
23
23
  # sharing_mode:: whether a shared or exclusive lock will be requested on the
24
24
  # reader; the possible values are +:shared+, +:exclusive+ and
25
- # +:direct+ (see the SCARD_SHARE_ constants in the PC/SC API)
25
+ # +:direct+ (see the SCARD_SHARE_ constants in the PC/SC API)
26
26
  # preferred_protocols:: the desired communication protocol; the possible
27
27
  # values are +:t0+, +:t1+, +:t15+, +:raw+, and +:any+
28
28
  # (see the SCARD_PROTOCOL_ constants in the PC/SC API)
@@ -33,13 +33,13 @@ class Card
33
33
  status = FFILib.card_connect context._handle, reader_name, sharing_mode,
34
34
  preferred_protocols, handle_ptr, protocol_ptr
35
35
  raise Smartcard::PCSC::Exception, status unless status == :success
36
-
36
+
37
37
  @context = context
38
38
  @sharing_mode = sharing_mode
39
39
  @_handle = handle_ptr[:value]
40
40
  set_protocol FFILib::PROTOCOLS[protocol_ptr[:value]]
41
41
  end
42
-
42
+
43
43
  # Updates internal buffers to reflect a change in the communication protocol.
44
44
  #
45
45
  # Args:
@@ -47,36 +47,32 @@ class Card
47
47
  # used to guess a valid protocol
48
48
  def set_protocol(protocol)
49
49
  @protocol = protocol
50
-
50
+
51
51
  case protocol
52
52
  when :t0
53
- @send_pci = @recv_pci = FFILib::PCI_T0
53
+ @send_pci = FFILib::PCI_T0
54
54
  when :t1
55
- @send_pci = @recv_pci = FFILib::PCI_T1
55
+ @send_pci = FFILib::PCI_T1
56
56
  when :raw
57
- @send_pci = @recv_pci = FFILib::PCI_RAW
57
+ @send_pci = FFILib::PCI_RAW
58
58
  else
59
59
  reconnect sharing_mode, guess_protocol_from_atr, :leave
60
- return self
61
- end
62
-
63
- # Windows really doesn't like a receiving IoRequest.
64
- if FFI::Platform.windows? || FFI::Platform.mac?
65
- @recv_pci = nil
60
+ return self
66
61
  end
62
+
67
63
  self
68
64
  end
69
65
  private :set_protocol
70
-
66
+
71
67
  # Reconnects to the smart-card, potentially using a different protocol.
72
68
  #
73
69
  # Args:
74
70
  # sharing_mode:: whether a shared or exclusive lock will be requested on the
75
71
  # reader; the possible values are +:shared+, +:exclusive+ and
76
- # +:direct+ (see the SCARD_SHARE_ constants in the PC/SC API)
72
+ # +:direct+ (see the SCARD_SHARE_ constants in the PC/SC API)
77
73
  # preferred_protocols:: the desired communication protocol; the possible
78
74
  # values are +:t0+, +:t1+, +:t15+, +:raw+, and +:any+
79
- # (see the SCARD_PROTOCOL_ constants in the PC/SC API)
75
+ # (see the SCARD_PROTOCOL_ constants in the PC/SC API)
80
76
  # disposition:: what to do with the smart-card right before disconnecting;
81
77
  # the possible values are +:leave+, +:reset+, +:unpower+, and
82
78
  # +:eject+ (see the SCARD_*_CARD constants in the PC/SC API)
@@ -86,11 +82,11 @@ class Card
86
82
  status = FFILib.card_reconnect @_handle, sharing_mode,
87
83
  preferred_protocols, disposition, protocol_ptr
88
84
  raise Smartcard::PCSC::Exception, status unless status == :success
89
-
85
+
90
86
  @sharing_mode = sharing_mode
91
87
  set_protocol FFILib::Protocol[protocol_ptr[:value]]
92
88
  end
93
-
89
+
94
90
  # Disconnects from the smart-card.
95
91
  #
96
92
  # Future method calls on this object will raise PC/SC errors.
@@ -110,9 +106,9 @@ class Card
110
106
  # Starts a transaction, obtaining an exclusive lock on the smart-card.
111
107
  def begin_transaction
112
108
  status = FFILib.begin_transaction @_handle
113
- raise Smartcard::PCSC::Exception, status unless status == :success
109
+ raise Smartcard::PCSC::Exception, status unless status == :success
114
110
  end
115
-
111
+
116
112
  # Ends a transaction started with begin_transaction.
117
113
  #
118
114
  # The calling application must be the owner of the previously started
@@ -126,7 +122,7 @@ class Card
126
122
  status = FFILib.end_transaction @_handle, disposition
127
123
  raise Smartcard::PCSC::Exception, status unless status == :success
128
124
  end
129
-
125
+
130
126
  # Performs a block inside a transaction, with an exclusive smart-card lock.
131
127
  #
132
128
  # Args:
@@ -138,8 +134,8 @@ class Card
138
134
  yield
139
135
  end_transaction disposition
140
136
  end
141
-
142
-
137
+
138
+
143
139
  def [](attribute_name)
144
140
  length_ptr = FFILib::WordPtr.new
145
141
  status = FFILib.get_attrib @_handle, attribute_name, nil, length_ptr
@@ -150,13 +146,13 @@ class Card
150
146
  status = FFILib.get_attrib @_handle, attribute_name, value_ptr,
151
147
  length_ptr
152
148
  raise Smartcard::PCSC::Exception, status unless status == :success
153
-
149
+
154
150
  value_ptr.get_bytes 0, length_ptr[:value]
155
151
  ensure
156
152
  value_ptr.free
157
- end
153
+ end
158
154
  end
159
-
155
+
160
156
  # Sets the value of an attribute in the interface driver.
161
157
  #
162
158
  # The interface driver may not implement all possible attributes.
@@ -171,34 +167,34 @@ class Card
171
167
  begin
172
168
  status = FFILib.set_attrib @_handle, attribute_name, value_ptr,
173
169
  value.length
174
- raise Smartcard::PCSC::Exception, status unless status == :success
170
+ raise Smartcard::PCSC::Exception, status unless status == :success
175
171
  value
176
172
  ensure
177
- value_ptr.free
173
+ value_ptr.free
178
174
  end
179
175
  end
180
-
176
+
181
177
  # Sends an APDU to the smart card, and returns the card's response.
182
178
  #
183
179
  # Args:
184
180
  # send_data:: string containing the APDU bytes to be sent to the card
185
- # receive_buffer_size: the maximum number of bytes that can be received
181
+ # receive_buffer_size: the maximum number of bytes that can be received
186
182
  def transmit(data, receive_buffer_size = 65546)
187
183
  send_ptr = FFI::MemoryPointer.from_string data
188
184
  recv_ptr = FFI::MemoryPointer.new receive_buffer_size
189
185
  recv_size_ptr = FFILib::WordPtr.new
190
- recv_size_ptr[:value] = receive_buffer_size
186
+ recv_size_ptr[:value] = receive_buffer_size
191
187
  begin
192
188
  status = FFILib.transmit @_handle, @send_pci, send_ptr, data.length,
193
- @recv_pci, recv_ptr, recv_size_ptr
194
- raise Smartcard::PCSC::Exception, status unless status == :success
189
+ nil, recv_ptr, recv_size_ptr
190
+ raise Smartcard::PCSC::Exception, status unless status == :success
195
191
  recv_ptr.get_bytes 0, recv_size_ptr[:value]
196
192
  ensure
197
193
  send_ptr.free
198
194
  recv_ptr.free
199
- end
195
+ end
200
196
  end
201
-
197
+
202
198
  # Sends a interface driver command for the smart-card reader.
203
199
  #
204
200
  # This method is useful for creating client side reader drivers for functions
@@ -220,20 +216,20 @@ class Card
220
216
  send_ptr = FFI::MemoryPointer.from_string data
221
217
  recv_ptr = FFI::MemoryPointer.new receive_buffer_size
222
218
  recv_size_ptr = FFILib::WordPtr.new
223
- recv_size_ptr[:value] = receive_buffer_size
219
+ recv_size_ptr[:value] = receive_buffer_size
224
220
  begin
225
221
  status = FFILib.card_control @_handle, code, send_ptr, data.length,
226
222
  recv_ptr, receive_buffer_size, recv_size_ptr
227
- raise Smartcard::PCSC::Exception, status unless status == :success
223
+ raise Smartcard::PCSC::Exception, status unless status == :success
228
224
  recv_ptr.get_bytes 0, recv_size_ptr[:value]
229
225
  ensure
230
226
  send_ptr.free
231
227
  recv_ptr.free
232
228
  end
233
229
  end
234
-
230
+
235
231
  # Assorted information about this smart-card.
236
- #
232
+ #
237
233
  # Returns a hash with the following keys:
238
234
  # :state:: reader/card status, as a Set of symbols; the possible values are
239
235
  # +:present+, +:swallowed+, +:absent+, +:specific+, and +:powered+
@@ -248,25 +244,25 @@ class Card
248
244
  protocol_ptr = FFILib::WordPtr.new
249
245
  atr_ptr = FFI::MemoryPointer.new FFILib::Consts::MAX_ATR_SIZE
250
246
  atr_length_ptr = FFILib::WordPtr.new
251
- atr_length_ptr[:value] = FFILib::Consts::MAX_ATR_SIZE
247
+ atr_length_ptr[:value] = FFILib::Consts::MAX_ATR_SIZE
252
248
 
253
249
  begin
254
250
  status = FFILib.card_status @_handle, nil, readers_length_ptr, state_ptr,
255
251
  protocol_ptr, atr_ptr, atr_length_ptr
256
- raise Smartcard::PCSC::Exception, status unless status == :success
252
+ raise Smartcard::PCSC::Exception, status unless status == :success
257
253
 
258
254
  readers_ptr = FFI::MemoryPointer.new :char, readers_length_ptr[:value]
259
255
  begin
260
256
  status = FFILib.card_status @_handle, readers_ptr, readers_length_ptr,
261
257
  state_ptr, protocol_ptr, atr_ptr, atr_length_ptr
262
- raise Smartcard::PCSC::Exception, status unless status == :success
263
-
258
+ raise Smartcard::PCSC::Exception, status unless status == :success
259
+
264
260
  state_word = state_ptr[:value]
265
261
  state = Set.new
266
262
  FFILib::CardState.to_h.each do |key, mask|
267
263
  state << key if (state_word & mask) == mask && mask != 0
268
264
  end
269
-
265
+
270
266
  { :readers => Context.decode_multi_string(readers_ptr),
271
267
  :protocol => FFILib::PROTOCOLS[protocol_ptr[:value]],
272
268
  :atr => atr_ptr.get_bytes(0, atr_length_ptr[:value]),
@@ -278,11 +274,11 @@ class Card
278
274
  atr_ptr.free
279
275
  end
280
276
  end
281
-
282
- # Returns the first valid protocol listed in the card's ATR.
277
+
278
+ # Returns the first valid protocol listed in the card's ATR.
283
279
  def guess_protocol_from_atr
284
280
  atr = info[:atr]
285
-
281
+
286
282
  # NOTE: inspired from the following sources:
287
283
  # http://en.wikipedia.org/wiki/Answer_to_reset
288
284
  # http://www.atmel.com/dyn/resources/prod_documents/doc5025.pdf
@@ -295,13 +291,13 @@ class Card
295
291
  next_bits = (0...4).map { |j| (next_nibble >> j) & 1 }
296
292
  next_bits.each { |bit| i += bit }
297
293
  if next_bits[3] == 1 # TD byte was last, i is right on it
298
- protocols << (atr_bytes[i] & 0x0f)
294
+ protocols << (atr_bytes[i] & 0x0f)
299
295
  else
300
296
  break # No TD, no more bytes
301
297
  end
302
298
  end
303
299
 
304
- protocols.sort!
300
+ protocols.sort!
305
301
  case protocols[0]
306
302
  when 0
307
303
  :t0
@@ -312,15 +308,15 @@ class Card
312
308
  end
313
309
  end
314
310
  private :guess_protocol_from_atr
315
-
311
+
316
312
  # The low-level _SCARDHANDLE_ data.
317
313
  #
318
314
  # This should not be used by client code.
319
315
  attr_reader :_handle
320
-
316
+
321
317
  # The communication protocol in use with this smart-card.
322
318
  attr_reader :protocol
323
-
319
+
324
320
  # The sharing mode for this smart-card session. (:shared or :exclusive)
325
321
  attr_reader :sharing_mode
326
322
  end # class Smartcard::PCSC::Card
@@ -7,214 +7,214 @@ module Smartcard::PCSC
7
7
  module FFILib
8
8
  # Constant values extracted from headers.
9
9
  module Consts
10
- SCARD_E_INVALID_VALUE = 0x80100011
11
- SCARD_E_NO_SERVICE = 0x8010001D
12
- SCARD_E_UNSUPPORTED_FEATURE = 0x8010001F
13
- SCARD_E_INVALID_ATR = 0x80100015
14
- SCARD_E_DUPLICATE_READER = 0x8010001B
15
- SCARD_W_UNSUPPORTED_CARD = 0x80100065
16
- SCARD_E_UNKNOWN_CARD = 0x8010000D
17
- SCARD_E_UNEXPECTED = 0x8010001F
18
- SCARD_E_SERVER_TOO_BUSY = 0x80100031
19
- SCARD_W_UNPOWERED_CARD = 0x80100067
20
- SCARD_W_CANCELLED_BY_USER = 0x8010006E
10
+ SCARD_S_SUCCESS = 0x00000000
21
11
  SCARD_E_CANCELLED = 0x80100002
22
- SCARD_E_INVALID_CHV = 0x8010002A
23
- SCARD_E_CERTIFICATE_UNAVAILABLE = 0x8010002D
24
- SCARD_W_SECURITY_VIOLATION = 0x8010006A
12
+ SCARD_E_INVALID_HANDLE = 0x80100003
25
13
  SCARD_E_INVALID_PARAMETER = 0x80100004
26
- SCARD_E_SYSTEM_CANCELLED = 0x80100012
27
- SCARD_E_NO_KEY_CONTAINER = 0x80100030
14
+ SCARD_E_INVALID_TARGET = 0x80100005
15
+ SCARD_E_NO_MEMORY = 0x80100006
16
+ SCARD_E_INSUFFICIENT_BUFFER = 0x80100008
17
+ SCARD_E_UNKNOWN_READER = 0x80100009
18
+ SCARD_E_TIMEOUT = 0x8010000A
19
+ SCARD_E_SHARING_VIOLATION = 0x8010000B
20
+ SCARD_E_NO_SMARTCARD = 0x8010000C
21
+ SCARD_E_UNKNOWN_CARD = 0x8010000D
22
+ SCARD_E_CANT_DISPOSE = 0x8010000E
23
+ SCARD_E_PROTO_MISMATCH = 0x8010000F
28
24
  SCARD_E_NOT_READY = 0x80100010
25
+ SCARD_E_INVALID_VALUE = 0x80100011
26
+ SCARD_E_SYSTEM_CANCELLED = 0x80100012
27
+ SCARD_E_INVALID_ATR = 0x80100015
29
28
  SCARD_E_NOT_TRANSACTED = 0x80100016
30
29
  SCARD_E_READER_UNAVAILABLE = 0x80100017
30
+ SCARD_E_PCI_TOO_SMALL = 0x80100019
31
31
  SCARD_E_READER_UNSUPPORTED = 0x8010001A
32
+ SCARD_E_DUPLICATE_READER = 0x8010001B
32
33
  SCARD_E_CARD_UNSUPPORTED = 0x8010001C
33
- SCARD_E_INVALID_TARGET = 0x80100005
34
- SCARD_E_NO_MEMORY = 0x80100006
35
- SCARD_E_UNKNOWN_READER = 0x80100009
36
- SCARD_E_NO_SMARTCARD = 0x8010000C
34
+ SCARD_E_NO_SERVICE = 0x8010001D
35
+ SCARD_E_SERVICE_STOPPED = 0x8010001E
36
+ SCARD_E_UNEXPECTED = 0x8010001F
37
+ SCARD_E_UNSUPPORTED_FEATURE = 0x8010001F
37
38
  SCARD_E_ICC_INSTALLATION = 0x80100020
39
+ SCARD_E_ICC_CREATEORDER = 0x80100021
40
+ SCARD_E_DIR_NOT_FOUND = 0x80100023
38
41
  SCARD_E_FILE_NOT_FOUND = 0x80100024
39
- SCARD_E_NO_SUCH_CERTIFICATE = 0x8010002C
40
- SCARD_W_WRONG_CHV = 0x8010006B
42
+ SCARD_E_NO_DIR = 0x80100025
43
+ SCARD_E_NO_FILE = 0x80100026
41
44
  SCARD_E_NO_ACCESS = 0x80100027
42
45
  SCARD_E_WRITE_TOO_MANY = 0x80100028
43
- SCARD_W_EOF = 0x8010006D
44
- SCARD_E_INVALID_HANDLE = 0x80100003
45
- SCARD_E_CANT_DISPOSE = 0x8010000E
46
- SCARD_E_SERVICE_STOPPED = 0x8010001E
47
- SCARD_E_ICC_CREATEORDER = 0x80100021
48
- SCARD_E_NO_FILE = 0x80100026
46
+ SCARD_E_BAD_SEEK = 0x80100029
47
+ SCARD_E_INVALID_CHV = 0x8010002A
48
+ SCARD_E_UNKNOWN_RES_MNG = 0x8010002B
49
+ SCARD_E_NO_SUCH_CERTIFICATE = 0x8010002C
50
+ SCARD_E_CERTIFICATE_UNAVAILABLE = 0x8010002D
49
51
  SCARD_E_NO_READERS_AVAILABLE = 0x8010002E
50
52
  SCARD_E_COMM_DATA_LOST = 0x8010002F
51
- SCARD_E_TIMEOUT = 0x8010000A
52
- SCARD_E_SHARING_VIOLATION = 0x8010000B
53
- SCARD_E_PROTO_MISMATCH = 0x8010000F
54
- SCARD_E_PCI_TOO_SMALL = 0x80100019
53
+ SCARD_E_NO_KEY_CONTAINER = 0x80100030
54
+ SCARD_E_SERVER_TOO_BUSY = 0x80100031
55
+ SCARD_W_UNSUPPORTED_CARD = 0x80100065
56
+ SCARD_W_UNRESPONSIVE_CARD = 0x80100066
57
+ SCARD_W_UNPOWERED_CARD = 0x80100067
55
58
  SCARD_W_RESET_CARD = 0x80100068
56
59
  SCARD_W_REMOVED_CARD = 0x80100069
57
- SCARD_S_SUCCESS = 0x00000000
58
- SCARD_E_INSUFFICIENT_BUFFER = 0x80100008
59
- SCARD_E_DIR_NOT_FOUND = 0x80100023
60
- SCARD_E_NO_DIR = 0x80100025
61
- SCARD_E_BAD_SEEK = 0x80100029
62
- SCARD_E_UNKNOWN_RES_MNG = 0x8010002B
63
- SCARD_W_UNRESPONSIVE_CARD = 0x80100066
60
+ SCARD_W_SECURITY_VIOLATION = 0x8010006A
61
+ SCARD_W_WRONG_CHV = 0x8010006B
64
62
  SCARD_W_CHV_BLOCKED = 0x8010006C
63
+ SCARD_W_EOF = 0x8010006D
64
+ SCARD_W_CANCELLED_BY_USER = 0x8010006E
65
65
  SCARD_W_CARD_NOT_AUTHENTICATED = 0x8010006F
66
66
  SCARD_SCOPE_USER = 0x00000000
67
- SCARD_SCOPE_SYSTEM = 0x00000002
68
67
  SCARD_SCOPE_TERMINAL = 0x00000001
68
+ SCARD_SCOPE_SYSTEM = 0x00000002
69
69
  SCARD_PROTOCOL_UNDEFINED = 0x00000000
70
70
  SCARD_PROTOCOL_UNSET = 0x00000000
71
71
  SCARD_PROTOCOL_T0 = 0x00000001
72
72
  SCARD_PROTOCOL_T1 = 0x00000002
73
73
  SCARD_PROTOCOL_RAW = 0x00000004
74
- SCARD_PROTOCOL_ANY = 0x00000003
75
74
  SCARD_PROTOCOL_T15 = 0x00000008
75
+ SCARD_PROTOCOL_ANY = 0x00000003
76
+ SCARD_SHARE_EXCLUSIVE = 0x00000001
76
77
  SCARD_SHARE_SHARED = 0x00000002
77
78
  SCARD_SHARE_DIRECT = 0x00000003
78
- SCARD_SHARE_EXCLUSIVE = 0x00000001
79
- SCARD_EJECT_CARD = 0x00000003
80
- SCARD_UNPOWER_CARD = 0x00000002
81
79
  SCARD_LEAVE_CARD = 0x00000000
82
80
  SCARD_RESET_CARD = 0x00000001
81
+ SCARD_UNPOWER_CARD = 0x00000002
82
+ SCARD_EJECT_CARD = 0x00000003
83
+ SCARD_ATTR_VENDOR_NAME = 0x00010100
84
+ SCARD_ATTR_VENDOR_IFD_TYPE = 0x00010101
85
+ SCARD_ATTR_VENDOR_IFD_VERSION = 0x00010102
86
+ SCARD_ATTR_VENDOR_IFD_SERIAL_NO = 0x00010103
87
+ SCARD_ATTR_CHANNEL_ID = 0x00020110
88
+ SCARD_ATTR_ASYNC_PROTOCOL_TYPES = 0x00030120
89
+ SCARD_ATTR_DEFAULT_CLK = 0x00030121
90
+ SCARD_ATTR_MAX_CLK = 0x00030122
91
+ SCARD_ATTR_DEFAULT_DATA_RATE = 0x00030123
92
+ SCARD_ATTR_MAX_DATA_RATE = 0x00030124
93
+ SCARD_ATTR_MAX_IFSD = 0x00030125
83
94
  SCARD_ATTR_SYNC_PROTOCOL_TYPES = 0x00030126
84
- SCARD_ATTR_CURRENT_CLK = 0x00080202
85
- SCARD_ATTR_CURRENT_EBC_ENCODING = 0x0008020B
95
+ SCARD_ATTR_POWER_MGMT_SUPPORT = 0x00040131
86
96
  SCARD_ATTR_USER_TO_CARD_AUTH_DEVICE = 0x00050140
97
+ SCARD_ATTR_USER_AUTH_INPUT_DEVICE = 0x00050142
98
+ SCARD_ATTR_CHARACTERISTICS = 0x00060150
99
+ SCARD_ATTR_CURRENT_PROTOCOL_TYPE = 0x00080201
100
+ SCARD_ATTR_CURRENT_CLK = 0x00080202
87
101
  SCARD_ATTR_CURRENT_F = 0x00080203
88
102
  SCARD_ATTR_CURRENT_D = 0x00080204
89
103
  SCARD_ATTR_CURRENT_N = 0x00080205
90
104
  SCARD_ATTR_CURRENT_W = 0x00080206
91
- SCARD_ATTR_DEVICE_FRIENDLY_NAME = 0x7FFF0003
92
- SCARD_ATTR_VENDOR_IFD_SERIAL_NO = 0x00010103
93
- SCARD_ATTR_ESC_RESET = 0x0007A000
94
- SCARD_ATTR_CHARACTERISTICS = 0x00060150
95
105
  SCARD_ATTR_CURRENT_IFSC = 0x00080207
96
106
  SCARD_ATTR_CURRENT_IFSD = 0x00080208
97
- SCARD_ATTR_MAX_CLK = 0x00030122
98
- SCARD_ATTR_MAX_DATA_RATE = 0x00030124
99
- SCARD_ATTR_CURRENT_PROTOCOL_TYPE = 0x00080201
107
+ SCARD_ATTR_CURRENT_BWT = 0x00080209
108
+ SCARD_ATTR_CURRENT_CWT = 0x0008020A
109
+ SCARD_ATTR_CURRENT_EBC_ENCODING = 0x0008020B
110
+ SCARD_ATTR_EXTENDED_BWT = 0x0008020C
111
+ SCARD_ATTR_ICC_PRESENCE = 0x00090300
112
+ SCARD_ATTR_ICC_INTERFACE_STATUS = 0x00090301
113
+ SCARD_ATTR_CURRENT_IO_STATE = 0x00090302
100
114
  SCARD_ATTR_ATR_STRING = 0x00090303
115
+ SCARD_ATTR_ICC_TYPE_PER_ATR = 0x00090304
116
+ SCARD_ATTR_ESC_RESET = 0x0007A000
117
+ SCARD_ATTR_ESC_CANCEL = 0x0007A003
101
118
  SCARD_ATTR_ESC_AUTHREQUEST = 0x0007A005
102
- SCARD_ATTR_DEVICE_SYSTEM_NAME_A = 0x7FFF0004
103
- SCARD_ATTR_DEVICE_SYSTEM_NAME_W = 0x7FFF0006
104
- SCARD_ATTR_DEFAULT_CLK = 0x00030121
105
- SCARD_ATTR_MAX_IFSD = 0x00030125
106
- SCARD_ATTR_VENDOR_NAME = 0x00010100
107
- SCARD_ATTR_ASYNC_PROTOCOL_TYPES = 0x00030120
119
+ SCARD_ATTR_MAXINPUT = 0x0007A007
108
120
  SCARD_ATTR_DEVICE_UNIT = 0x7FFF0001
121
+ SCARD_ATTR_DEVICE_IN_USE = 0x7FFF0002
109
122
  SCARD_ATTR_DEVICE_FRIENDLY_NAME_A = 0x7FFF0003
123
+ SCARD_ATTR_DEVICE_SYSTEM_NAME_A = 0x7FFF0004
110
124
  SCARD_ATTR_DEVICE_FRIENDLY_NAME_W = 0x7FFF0005
125
+ SCARD_ATTR_DEVICE_SYSTEM_NAME_W = 0x7FFF0006
111
126
  SCARD_ATTR_SUPRESS_T1_IFS_REQUEST = 0x7FFF0007
112
- SCARD_ATTR_CURRENT_BWT = 0x00080209
113
- SCARD_ATTR_CURRENT_CWT = 0x0008020A
114
- SCARD_ATTR_ICC_PRESENCE = 0x00090300
115
- SCARD_ATTR_ESC_CANCEL = 0x0007A003
116
- SCARD_ATTR_DEVICE_IN_USE = 0x7FFF0002
117
- SCARD_ATTR_USER_AUTH_INPUT_DEVICE = 0x00050142
118
- SCARD_ATTR_CURRENT_IO_STATE = 0x00090302
127
+ SCARD_ATTR_DEVICE_FRIENDLY_NAME = 0x7FFF0003
119
128
  SCARD_ATTR_DEVICE_SYSTEM_NAME = 0x7FFF0004
120
- SCARD_ATTR_VENDOR_IFD_TYPE = 0x00010101
121
- SCARD_ATTR_DEFAULT_DATA_RATE = 0x00030123
122
- SCARD_ATTR_ICC_TYPE_PER_ATR = 0x00090304
123
- SCARD_ATTR_VENDOR_IFD_VERSION = 0x00010102
124
- SCARD_ATTR_CHANNEL_ID = 0x00020110
125
- SCARD_ATTR_POWER_MGMT_SUPPORT = 0x00040131
126
- SCARD_ATTR_EXTENDED_BWT = 0x0008020C
127
- SCARD_ATTR_ICC_INTERFACE_STATUS = 0x00090301
128
- SCARD_ATTR_MAXINPUT = 0x0007A007
129
- SCARD_STATE_CHANGED = 0x00000002
130
- SCARD_STATE_MUTE = 0x00000200
129
+ SCARD_STATE_UNAWARE = 0x00000000
131
130
  SCARD_STATE_IGNORE = 0x00000001
131
+ SCARD_STATE_CHANGED = 0x00000002
132
+ SCARD_STATE_UNKNOWN = 0x00000004
132
133
  SCARD_STATE_UNAVAILABLE = 0x00000008
133
134
  SCARD_STATE_EMPTY = 0x00000010
134
- SCARD_STATE_UNKNOWN = 0x00000004
135
- SCARD_STATE_ATRMATCH = 0x00000040
136
135
  SCARD_STATE_PRESENT = 0x00000020
136
+ SCARD_STATE_ATRMATCH = 0x00000040
137
137
  SCARD_STATE_EXCLUSIVE = 0x00000080
138
138
  SCARD_STATE_INUSE = 0x00000100
139
+ SCARD_STATE_MUTE = 0x00000200
139
140
  SCARD_STATE_UNPOWERED = 0x00000400
140
- SCARD_STATE_UNAWARE = 0x00000000
141
- SCARD_PRESENT = 0x00000004
142
141
  SCARD_AUTOALLOCATE = 0xFFFFFFFF
142
+ SCARD_UNKNOWN = 0x00000001
143
143
  SCARD_ABSENT = 0x00000002
144
+ SCARD_PRESENT = 0x00000004
144
145
  SCARD_SWALLOWED = 0x00000008
145
- SCARD_UNKNOWN = 0x00000001
146
146
  SCARD_POWERED = 0x00000010
147
- SCARD_SPECIFIC = 0x00000040
148
147
  SCARD_NEGOTIABLE = 0x00000020
148
+ SCARD_SPECIFIC = 0x00000040
149
149
  MAX_ATR_SIZE = 0x00000021
150
150
  INFINITE = 0xFFFFFFFF
151
151
  end # module Smartcard::PCSC::FFILib::Consts
152
152
 
153
153
  # Error codes returned by the PCSC functions.
154
154
  Status = enum [
155
- :invalid_value, Consts::SCARD_E_INVALID_VALUE,
156
- :no_service, Consts::SCARD_E_NO_SERVICE,
157
- :unsupported_feature, Consts::SCARD_E_UNSUPPORTED_FEATURE,
158
- :invalid_atr, Consts::SCARD_E_INVALID_ATR,
159
- :duplicate_reader, Consts::SCARD_E_DUPLICATE_READER,
160
- :unsupported_card, Consts::SCARD_W_UNSUPPORTED_CARD,
161
- :unknown_card, Consts::SCARD_E_UNKNOWN_CARD,
162
- :unexpected, Consts::SCARD_E_UNEXPECTED,
163
- :server_too_busy, Consts::SCARD_E_SERVER_TOO_BUSY,
164
- :unpowered_card, Consts::SCARD_W_UNPOWERED_CARD,
165
- :cancelled_by_user, Consts::SCARD_W_CANCELLED_BY_USER,
155
+ :success, Consts::SCARD_S_SUCCESS,
166
156
  :cancelled, Consts::SCARD_E_CANCELLED,
167
- :invalid_chv, Consts::SCARD_E_INVALID_CHV,
168
- :certificate_unavailable, Consts::SCARD_E_CERTIFICATE_UNAVAILABLE,
169
- :security_violation, Consts::SCARD_W_SECURITY_VIOLATION,
157
+ :invalid_handle, Consts::SCARD_E_INVALID_HANDLE,
170
158
  :invalid_parameter, Consts::SCARD_E_INVALID_PARAMETER,
171
- :system_cancelled, Consts::SCARD_E_SYSTEM_CANCELLED,
172
- :no_key_container, Consts::SCARD_E_NO_KEY_CONTAINER,
159
+ :invalid_target, Consts::SCARD_E_INVALID_TARGET,
160
+ :no_memory, Consts::SCARD_E_NO_MEMORY,
161
+ :insufficient_buffer, Consts::SCARD_E_INSUFFICIENT_BUFFER,
162
+ :unknown_reader, Consts::SCARD_E_UNKNOWN_READER,
163
+ :timeout, Consts::SCARD_E_TIMEOUT,
164
+ :sharing_violation, Consts::SCARD_E_SHARING_VIOLATION,
165
+ :no_smartcard, Consts::SCARD_E_NO_SMARTCARD,
166
+ :unknown_card, Consts::SCARD_E_UNKNOWN_CARD,
167
+ :cant_dispose, Consts::SCARD_E_CANT_DISPOSE,
168
+ :proto_mismatch, Consts::SCARD_E_PROTO_MISMATCH,
173
169
  :not_ready, Consts::SCARD_E_NOT_READY,
170
+ :invalid_value, Consts::SCARD_E_INVALID_VALUE,
171
+ :system_cancelled, Consts::SCARD_E_SYSTEM_CANCELLED,
172
+ :invalid_atr, Consts::SCARD_E_INVALID_ATR,
174
173
  :not_transacted, Consts::SCARD_E_NOT_TRANSACTED,
175
174
  :reader_unavailable, Consts::SCARD_E_READER_UNAVAILABLE,
175
+ :pci_too_small, Consts::SCARD_E_PCI_TOO_SMALL,
176
176
  :reader_unsupported, Consts::SCARD_E_READER_UNSUPPORTED,
177
+ :duplicate_reader, Consts::SCARD_E_DUPLICATE_READER,
177
178
  :card_unsupported, Consts::SCARD_E_CARD_UNSUPPORTED,
178
- :invalid_target, Consts::SCARD_E_INVALID_TARGET,
179
- :no_memory, Consts::SCARD_E_NO_MEMORY,
180
- :unknown_reader, Consts::SCARD_E_UNKNOWN_READER,
181
- :no_smartcard, Consts::SCARD_E_NO_SMARTCARD,
179
+ :no_service, Consts::SCARD_E_NO_SERVICE,
180
+ :service_stopped, Consts::SCARD_E_SERVICE_STOPPED,
181
+ :unexpected, Consts::SCARD_E_UNEXPECTED,
182
+ :unsupported_feature, Consts::SCARD_E_UNSUPPORTED_FEATURE,
182
183
  :icc_installation, Consts::SCARD_E_ICC_INSTALLATION,
184
+ :icc_createorder, Consts::SCARD_E_ICC_CREATEORDER,
185
+ :dir_not_found, Consts::SCARD_E_DIR_NOT_FOUND,
183
186
  :file_not_found, Consts::SCARD_E_FILE_NOT_FOUND,
184
- :no_such_certificate, Consts::SCARD_E_NO_SUCH_CERTIFICATE,
185
- :wrong_chv, Consts::SCARD_W_WRONG_CHV,
187
+ :no_dir, Consts::SCARD_E_NO_DIR,
188
+ :no_file, Consts::SCARD_E_NO_FILE,
186
189
  :no_access, Consts::SCARD_E_NO_ACCESS,
187
190
  :write_too_many, Consts::SCARD_E_WRITE_TOO_MANY,
188
- :eof, Consts::SCARD_W_EOF,
189
- :invalid_handle, Consts::SCARD_E_INVALID_HANDLE,
190
- :cant_dispose, Consts::SCARD_E_CANT_DISPOSE,
191
- :service_stopped, Consts::SCARD_E_SERVICE_STOPPED,
192
- :icc_createorder, Consts::SCARD_E_ICC_CREATEORDER,
193
- :no_file, Consts::SCARD_E_NO_FILE,
191
+ :bad_seek, Consts::SCARD_E_BAD_SEEK,
192
+ :invalid_chv, Consts::SCARD_E_INVALID_CHV,
193
+ :unknown_res_mng, Consts::SCARD_E_UNKNOWN_RES_MNG,
194
+ :no_such_certificate, Consts::SCARD_E_NO_SUCH_CERTIFICATE,
195
+ :certificate_unavailable, Consts::SCARD_E_CERTIFICATE_UNAVAILABLE,
194
196
  :no_readers_available, Consts::SCARD_E_NO_READERS_AVAILABLE,
195
197
  :comm_data_lost, Consts::SCARD_E_COMM_DATA_LOST,
196
- :timeout, Consts::SCARD_E_TIMEOUT,
197
- :sharing_violation, Consts::SCARD_E_SHARING_VIOLATION,
198
- :proto_mismatch, Consts::SCARD_E_PROTO_MISMATCH,
199
- :pci_too_small, Consts::SCARD_E_PCI_TOO_SMALL,
198
+ :no_key_container, Consts::SCARD_E_NO_KEY_CONTAINER,
199
+ :server_too_busy, Consts::SCARD_E_SERVER_TOO_BUSY,
200
+ :unsupported_card, Consts::SCARD_W_UNSUPPORTED_CARD,
201
+ :unresponsive_card, Consts::SCARD_W_UNRESPONSIVE_CARD,
202
+ :unpowered_card, Consts::SCARD_W_UNPOWERED_CARD,
200
203
  :reset_card, Consts::SCARD_W_RESET_CARD,
201
204
  :removed_card, Consts::SCARD_W_REMOVED_CARD,
202
- :success, Consts::SCARD_S_SUCCESS,
203
- :insufficient_buffer, Consts::SCARD_E_INSUFFICIENT_BUFFER,
204
- :dir_not_found, Consts::SCARD_E_DIR_NOT_FOUND,
205
- :no_dir, Consts::SCARD_E_NO_DIR,
206
- :bad_seek, Consts::SCARD_E_BAD_SEEK,
207
- :unknown_res_mng, Consts::SCARD_E_UNKNOWN_RES_MNG,
208
- :unresponsive_card, Consts::SCARD_W_UNRESPONSIVE_CARD,
205
+ :security_violation, Consts::SCARD_W_SECURITY_VIOLATION,
206
+ :wrong_chv, Consts::SCARD_W_WRONG_CHV,
209
207
  :chv_blocked, Consts::SCARD_W_CHV_BLOCKED,
208
+ :eof, Consts::SCARD_W_EOF,
209
+ :cancelled_by_user, Consts::SCARD_W_CANCELLED_BY_USER,
210
210
  :card_not_authenticated, Consts::SCARD_W_CARD_NOT_AUTHENTICATED,
211
211
  ]
212
212
 
213
213
  # Values for the context's scope.
214
214
  Scope = enum [
215
215
  :user, Consts::SCARD_SCOPE_USER,
216
- :system, Consts::SCARD_SCOPE_SYSTEM,
217
216
  :terminal, Consts::SCARD_SCOPE_TERMINAL,
217
+ :system, Consts::SCARD_SCOPE_SYSTEM,
218
218
  ]
219
219
 
220
220
  # Smart-card communication protocols.
@@ -224,101 +224,101 @@ module FFILib
224
224
  :t0, Consts::SCARD_PROTOCOL_T0,
225
225
  :t1, Consts::SCARD_PROTOCOL_T1,
226
226
  :raw, Consts::SCARD_PROTOCOL_RAW,
227
- :any, Consts::SCARD_PROTOCOL_ANY,
228
227
  :t15, Consts::SCARD_PROTOCOL_T15,
228
+ :any, Consts::SCARD_PROTOCOL_ANY,
229
229
  ]
230
230
 
231
231
  # Smart-card sharing modes.
232
232
  Share = enum [
233
+ :exclusive, Consts::SCARD_SHARE_EXCLUSIVE,
233
234
  :shared, Consts::SCARD_SHARE_SHARED,
234
235
  :direct, Consts::SCARD_SHARE_DIRECT,
235
- :exclusive, Consts::SCARD_SHARE_EXCLUSIVE,
236
236
  ]
237
237
 
238
238
  # Smart-card dispositions.
239
239
  Disposition = enum [
240
- :eject, Consts::SCARD_EJECT_CARD,
241
- :unpower, Consts::SCARD_UNPOWER_CARD,
242
240
  :leave, Consts::SCARD_LEAVE_CARD,
243
241
  :reset, Consts::SCARD_RESET_CARD,
242
+ :unpower, Consts::SCARD_UNPOWER_CARD,
243
+ :eject, Consts::SCARD_EJECT_CARD,
244
244
  ]
245
245
 
246
246
  # Smart-card reader attributes.
247
247
  Attribute = enum [
248
+ :vendor_name, Consts::SCARD_ATTR_VENDOR_NAME,
249
+ :vendor_ifd_type, Consts::SCARD_ATTR_VENDOR_IFD_TYPE,
250
+ :vendor_ifd_version, Consts::SCARD_ATTR_VENDOR_IFD_VERSION,
251
+ :vendor_ifd_serial_no, Consts::SCARD_ATTR_VENDOR_IFD_SERIAL_NO,
252
+ :channel_id, Consts::SCARD_ATTR_CHANNEL_ID,
253
+ :async_protocol_types, Consts::SCARD_ATTR_ASYNC_PROTOCOL_TYPES,
254
+ :default_clk, Consts::SCARD_ATTR_DEFAULT_CLK,
255
+ :max_clk, Consts::SCARD_ATTR_MAX_CLK,
256
+ :default_data_rate, Consts::SCARD_ATTR_DEFAULT_DATA_RATE,
257
+ :max_data_rate, Consts::SCARD_ATTR_MAX_DATA_RATE,
258
+ :max_ifsd, Consts::SCARD_ATTR_MAX_IFSD,
248
259
  :sync_protocol_types, Consts::SCARD_ATTR_SYNC_PROTOCOL_TYPES,
249
- :current_clk, Consts::SCARD_ATTR_CURRENT_CLK,
250
- :current_ebc_encoding, Consts::SCARD_ATTR_CURRENT_EBC_ENCODING,
260
+ :power_mgmt_support, Consts::SCARD_ATTR_POWER_MGMT_SUPPORT,
251
261
  :user_to_card_auth_device, Consts::SCARD_ATTR_USER_TO_CARD_AUTH_DEVICE,
262
+ :user_auth_input_device, Consts::SCARD_ATTR_USER_AUTH_INPUT_DEVICE,
263
+ :characteristics, Consts::SCARD_ATTR_CHARACTERISTICS,
264
+ :current_protocol_type, Consts::SCARD_ATTR_CURRENT_PROTOCOL_TYPE,
265
+ :current_clk, Consts::SCARD_ATTR_CURRENT_CLK,
252
266
  :current_f, Consts::SCARD_ATTR_CURRENT_F,
253
267
  :current_d, Consts::SCARD_ATTR_CURRENT_D,
254
268
  :current_n, Consts::SCARD_ATTR_CURRENT_N,
255
269
  :current_w, Consts::SCARD_ATTR_CURRENT_W,
256
- :device_friendly_name, Consts::SCARD_ATTR_DEVICE_FRIENDLY_NAME,
257
- :vendor_ifd_serial_no, Consts::SCARD_ATTR_VENDOR_IFD_SERIAL_NO,
258
- :esc_reset, Consts::SCARD_ATTR_ESC_RESET,
259
- :characteristics, Consts::SCARD_ATTR_CHARACTERISTICS,
260
270
  :current_ifsc, Consts::SCARD_ATTR_CURRENT_IFSC,
261
271
  :current_ifsd, Consts::SCARD_ATTR_CURRENT_IFSD,
262
- :max_clk, Consts::SCARD_ATTR_MAX_CLK,
263
- :max_data_rate, Consts::SCARD_ATTR_MAX_DATA_RATE,
264
- :current_protocol_type, Consts::SCARD_ATTR_CURRENT_PROTOCOL_TYPE,
272
+ :current_bwt, Consts::SCARD_ATTR_CURRENT_BWT,
273
+ :current_cwt, Consts::SCARD_ATTR_CURRENT_CWT,
274
+ :current_ebc_encoding, Consts::SCARD_ATTR_CURRENT_EBC_ENCODING,
275
+ :extended_bwt, Consts::SCARD_ATTR_EXTENDED_BWT,
276
+ :icc_presence, Consts::SCARD_ATTR_ICC_PRESENCE,
277
+ :icc_interface_status, Consts::SCARD_ATTR_ICC_INTERFACE_STATUS,
278
+ :current_io_state, Consts::SCARD_ATTR_CURRENT_IO_STATE,
265
279
  :atr_string, Consts::SCARD_ATTR_ATR_STRING,
280
+ :icc_type_per_atr, Consts::SCARD_ATTR_ICC_TYPE_PER_ATR,
281
+ :esc_reset, Consts::SCARD_ATTR_ESC_RESET,
282
+ :esc_cancel, Consts::SCARD_ATTR_ESC_CANCEL,
266
283
  :esc_authrequest, Consts::SCARD_ATTR_ESC_AUTHREQUEST,
267
- :device_system_name_a, Consts::SCARD_ATTR_DEVICE_SYSTEM_NAME_A,
268
- :device_system_name_w, Consts::SCARD_ATTR_DEVICE_SYSTEM_NAME_W,
269
- :default_clk, Consts::SCARD_ATTR_DEFAULT_CLK,
270
- :max_ifsd, Consts::SCARD_ATTR_MAX_IFSD,
271
- :vendor_name, Consts::SCARD_ATTR_VENDOR_NAME,
272
- :async_protocol_types, Consts::SCARD_ATTR_ASYNC_PROTOCOL_TYPES,
284
+ :maxinput, Consts::SCARD_ATTR_MAXINPUT,
273
285
  :device_unit, Consts::SCARD_ATTR_DEVICE_UNIT,
286
+ :device_in_use, Consts::SCARD_ATTR_DEVICE_IN_USE,
274
287
  :device_friendly_name_a, Consts::SCARD_ATTR_DEVICE_FRIENDLY_NAME_A,
288
+ :device_system_name_a, Consts::SCARD_ATTR_DEVICE_SYSTEM_NAME_A,
275
289
  :device_friendly_name_w, Consts::SCARD_ATTR_DEVICE_FRIENDLY_NAME_W,
290
+ :device_system_name_w, Consts::SCARD_ATTR_DEVICE_SYSTEM_NAME_W,
276
291
  :supress_t1_ifs_request, Consts::SCARD_ATTR_SUPRESS_T1_IFS_REQUEST,
277
- :current_bwt, Consts::SCARD_ATTR_CURRENT_BWT,
278
- :current_cwt, Consts::SCARD_ATTR_CURRENT_CWT,
279
- :icc_presence, Consts::SCARD_ATTR_ICC_PRESENCE,
280
- :esc_cancel, Consts::SCARD_ATTR_ESC_CANCEL,
281
- :device_in_use, Consts::SCARD_ATTR_DEVICE_IN_USE,
282
- :user_auth_input_device, Consts::SCARD_ATTR_USER_AUTH_INPUT_DEVICE,
283
- :current_io_state, Consts::SCARD_ATTR_CURRENT_IO_STATE,
292
+ :device_friendly_name, Consts::SCARD_ATTR_DEVICE_FRIENDLY_NAME,
284
293
  :device_system_name, Consts::SCARD_ATTR_DEVICE_SYSTEM_NAME,
285
- :vendor_ifd_type, Consts::SCARD_ATTR_VENDOR_IFD_TYPE,
286
- :default_data_rate, Consts::SCARD_ATTR_DEFAULT_DATA_RATE,
287
- :icc_type_per_atr, Consts::SCARD_ATTR_ICC_TYPE_PER_ATR,
288
- :vendor_ifd_version, Consts::SCARD_ATTR_VENDOR_IFD_VERSION,
289
- :channel_id, Consts::SCARD_ATTR_CHANNEL_ID,
290
- :power_mgmt_support, Consts::SCARD_ATTR_POWER_MGMT_SUPPORT,
291
- :extended_bwt, Consts::SCARD_ATTR_EXTENDED_BWT,
292
- :icc_interface_status, Consts::SCARD_ATTR_ICC_INTERFACE_STATUS,
293
- :maxinput, Consts::SCARD_ATTR_MAXINPUT,
294
294
  ]
295
295
 
296
296
  # Smart-card states.
297
297
  CardState = enum [
298
- :changed, Consts::SCARD_STATE_CHANGED,
299
- :mute, Consts::SCARD_STATE_MUTE,
298
+ :unaware, Consts::SCARD_STATE_UNAWARE,
300
299
  :ignore, Consts::SCARD_STATE_IGNORE,
300
+ :changed, Consts::SCARD_STATE_CHANGED,
301
+ :unknown, Consts::SCARD_STATE_UNKNOWN,
301
302
  :unavailable, Consts::SCARD_STATE_UNAVAILABLE,
302
303
  :empty, Consts::SCARD_STATE_EMPTY,
303
- :unknown, Consts::SCARD_STATE_UNKNOWN,
304
- :atrmatch, Consts::SCARD_STATE_ATRMATCH,
305
304
  :present, Consts::SCARD_STATE_PRESENT,
305
+ :atrmatch, Consts::SCARD_STATE_ATRMATCH,
306
306
  :exclusive, Consts::SCARD_STATE_EXCLUSIVE,
307
307
  :inuse, Consts::SCARD_STATE_INUSE,
308
+ :mute, Consts::SCARD_STATE_MUTE,
308
309
  :unpowered, Consts::SCARD_STATE_UNPOWERED,
309
- :unaware, Consts::SCARD_STATE_UNAWARE,
310
310
  ]
311
311
 
312
312
  # Smart-card reader states.
313
313
  State = enum [
314
- :present, Consts::SCARD_PRESENT,
315
314
  :autoallocate, Consts::SCARD_AUTOALLOCATE,
315
+ :unknown, Consts::SCARD_UNKNOWN,
316
316
  :absent, Consts::SCARD_ABSENT,
317
+ :present, Consts::SCARD_PRESENT,
317
318
  :swallowed, Consts::SCARD_SWALLOWED,
318
- :unknown, Consts::SCARD_UNKNOWN,
319
319
  :powered, Consts::SCARD_POWERED,
320
- :specific, Consts::SCARD_SPECIFIC,
321
320
  :negotiable, Consts::SCARD_NEGOTIABLE,
321
+ :specific, Consts::SCARD_SPECIFIC,
322
322
  ]
323
323
 
324
324
  end # module Smartcard::PCSC::FFILib