1
2
3
4
5
6
7
8
9
10 """
11 The smartcard.scard module is a simple wrapper on top of the C language
12 PCSC SCardXXX API.
13
14 The smartcard.scard module is the lower layer of the pyscard
15 framework that provides a higher level interface.
16
17 You should avoid using the smartcard.scard package directly, and use the
18 pyscard directly because:
19
20 - smartcard.scard being a C wrapper, the code tends to look like C code
21 written in python syntax
22
23 - the smartcard package provides higher level abstractions (e.g.
24 CardType, CardConnection), and makes programming easier since it is
25 totally written in Python
26
27 You can still use the smartcard.scard package if you want to write your
28 own framework, or if you want to perform quick-and-dirty port of C
29 language programs using SCardXXX calls, or if there are features of
30 SCardXXX API that you want to use and that are not available in the
31 pyscard library.
32
33 Introduction
34
35 The smartcard.scard module is a Python wrapper around PCSC smart card base
36 services. On Windows, the wrapper is performed around the smart card base
37 components winscard library. On linux and OS X, the wrapper is performed
38 around the PCSC-lite library.
39
40
41 The smartcard.scard module provides mapping for the following API functions,
42 depending on the Operating System:
43
44 =============================== ======= =======
45 Function Windows Linux
46 OS X
47 =============================== ======= =======
48 GetOpenCardName
49 SCardAddReaderToGroup Y
50 SCardBeginTransaction Y Y
51 SCardCancel Y Y
52 SCardConnect Y Y
53 SCardControl Y Y
54 SCardDisconnect Y Y
55 SCardEndTransaction Y Y
56 SCardEstablishConteYt Y Y
57 SCardForgetCardType Y
58 SCardForgetReader Y
59 SCardForgetReaderGroup Y
60 SCardFreeMemory
61 SCardGetAttrib Y Y
62 SCardGetCardTypeProviderName Y
63 SCardGetErrorMessage Y
64 SCardGetProviderId
65 SCardGetStatusChange Y Y
66 SCardIntroduceCardType Y
67 SCardIntroduceReader Y
68 SCardIntroduceReaderGroup Y
69 SCardIsValidConteYt Y Y
70 SCardListCards Y
71 SCardListInterfaces Y
72 SCardListReaderGroups Y Y
73 SCardListReaders Y Y
74 SCardLocateCards Y
75 SCardReconnect Y Y
76 SCardReleaseConteYt Y Y
77 SCardRemoveReaderFromGroup Y
78 SCardSetAttrib Y Y
79 SCardSetCartTypeProviderName
80 SCardStatus Y Y
81 SCardTransmit Y Y
82 SCardUIDlgSelectCard
83 =============================== ======= =======
84
85 Comments, bug reports, improvements welcome.
86
87 -------------------------------------------------------------------------------
88 Copyright 2001-2012 gemalto
89 @Author: Jean-Daniel Aussel, mailto:jean-daniel.aussel@gemalto.com
90 @Author: Ludovic Rousseau, mailto:ludovic.rousseau@free.fr
91
92 This file is part of pyscard.
93
94 pyscard is free software; you can redistribute it and/or modify it
95 under the terms of the GNU Lesser General Public License as published by
96 the Free Software Foundation; either version 2.1 of the License, or (at
97 your option) any later version.
98
99 pyscard is distributed in the hope that it will be useful, but
100 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
101 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
102 License for more details.
103
104 You should have received a copy of the GNU Lesser General Public License
105 along with pyscard; if not, write to the Free Software Foundation,
106 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
107
108
109 """
110
111
112 from sys import version_info as _swig_python_version_info
113 if _swig_python_version_info >= (2, 7, 0):
115 import importlib
116 pkg = __name__.rpartition('.')[0]
117 mname = '.'.join((pkg, '_scard')).lstrip('.')
118 try:
119 return importlib.import_module(mname)
120 except ImportError:
121 return importlib.import_module('_scard')
122 _scard = swig_import_helper()
123 del swig_import_helper
124 elif _swig_python_version_info >= (2, 6, 0):
126 from os.path import dirname
127 import imp
128 fp = None
129 try:
130 fp, pathname, description = imp.find_module('_scard', [dirname(__file__)])
131 except ImportError:
132 import _scard
133 return _scard
134 if fp is not None:
135 try:
136 _mod = imp.load_module('_scard', fp, pathname, description)
137 finally:
138 fp.close()
139 return _mod
140 _scard = swig_import_helper()
141 del swig_import_helper
142 else:
143 import _scard
144 del _swig_python_version_info
145 try:
146 _swig_property = property
147 except NameError:
148 pass
149
150 try:
151 import builtins as __builtin__
152 except ImportError:
153 import __builtin__
154
156 if (name == "thisown"):
157 return self.this.own(value)
158 if (name == "this"):
159 if type(value).__name__ == 'SwigPyObject':
160 self.__dict__[name] = value
161 return
162 method = class_type.__swig_setmethods__.get(name, None)
163 if method:
164 return method(self, value)
165 if (not static):
166 if _newclass:
167 object.__setattr__(self, name, value)
168 else:
169 self.__dict__[name] = value
170 else:
171 raise AttributeError("You cannot add attributes to %s" % self)
172
173
176
177
179 if (name == "thisown"):
180 return self.this.own()
181 method = class_type.__swig_getmethods__.get(name, None)
182 if method:
183 return method(self)
184 raise AttributeError("'%s' object has no attribute '%s'" % (class_type.__name__, name))
185
186
188 try:
189 strthis = "proxy of " + self.this.__repr__()
190 except __builtin__.Exception:
191 strthis = ""
192 return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
193
194 try:
195 _object = object
196 _newclass = 1
197 except __builtin__.Exception:
200 _newclass = 0
201
202
204 """
205 SCardIsValidContext( hcontext) -> SCARDRETCODE
206
207 Parameters
208 ----------
209 hcontext: context handle return from SCardEstablishContext()
210
211
212
213 This function determines whether a smart card context handle is still
214 valid. After a smart card context handle has been set by
215 SCardEstablishContext(), it may become not valid if the resource manager
216 service has been shut down.
217
218 from smartcard.scard import *
219 hresult, hcontext = SCardEstablishContext(SCARD_SCOPE_USER)
220 hresult = SCardIsValidContext(hcontext)
221 if hresult != SCARD_S_SUCCESS:
222 raise error, 'Invalid context: ' + SCardGetErrorMessage(hresult)
223 ...
224
225 """
226 return _scard.SCardIsValidContext(hcontext)
227
229 """
230 SCardGetAttrib( hcard, dwAttrId) -> SCARDRETCODE
231
232 Parameters
233 ----------
234 hcard: card handle return from SCardConnect()
235 dwAttrId: value of attribute to get
236
237
238
239
240 This function get an attribute from the IFD Handler.
241
242 The possible attributes are:
243
244 ======================================== ======= =======
245 Attribute Windows PSCS
246 lite
247 ======================================== ======= =======
248 SCARD_ATTR_ASYNC_PROTOCOL_TYPES Y
249 SCARD_ATTR_ATR_STRING Y Y
250 SCARD_ATTR_CHANNEL_ID Y Y
251 SCARD_ATTR_CHARACTERISTICS Y Y
252 SCARD_ATTR_CURRENT_BWT Y Y
253 SCARD_ATTR_CURRENT_CLK Y Y
254 SCARD_ATTR_CURRENT_CWT Y Y
255 SCARD_ATTR_CURRENT_D Y Y
256 SCARD_ATTR_CURRENT_EBC_ENCODING Y Y
257 SCARD_ATTR_CURRENT_F Y Y
258 SCARD_ATTR_CURRENT_IFSC Y Y
259 SCARD_ATTR_CURRENT_IFSD Y Y
260 SCARD_ATTR_CURRENT_IO_STATE Y Y
261 SCARD_ATTR_CURRENT_N Y Y
262 SCARD_ATTR_CURRENT_PROTOCOL_TYPE Y Y
263 SCARD_ATTR_CURRENT_W Y Y
264 SCARD_ATTR_DEFAULT_CLK Y Y
265 SCARD_ATTR_DEFAULT_DATA_RATE Y Y
266 SCARD_ATTR_DEVICE_FRIENDLY_NAME_A Y Y
267 SCARD_ATTR_DEVICE_FRIENDLY_NAME_W Y Y
268 SCARD_ATTR_DEVICE_IN_USE Y Y
269 SCARD_ATTR_DEVICE_SYSTEM_NAME_A Y Y
270 SCARD_ATTR_DEVICE_SYSTEM_NAME_W Y Y
271 SCARD_ATTR_DEVICE_UNIT Y Y
272 SCARD_ATTR_ESC_AUTHREQUEST Y Y
273 SCARD_ATTR_ESC_CANCEL Y Y
274 SCARD_ATTR_ESC_RESET Y Y
275 SCARD_ATTR_EXTENDED_BWT Y Y
276 SCARD_ATTR_ICC_INTERFACE_STATUS Y Y
277 SCARD_ATTR_ICC_PRESENCE Y Y
278 SCARD_ATTR_ICC_TYPE_PER_ATR Y Y
279 SCARD_ATTR_MAXINPUT Y Y
280 SCARD_ATTR_MAX_CLK Y Y
281 SCARD_ATTR_MAX_DATA_RATE Y Y
282 SCARD_ATTR_MAX_IFSD Y Y
283 SCARD_ATTR_POWER_MGMT_SUPPORT Y Y
284 SCARD_ATTR_SUPRESS_T1_IFS_REQUEST Y Y
285 SCARD_ATTR_SYNC_PROTOCOL_TYPES Y
286 SCARD_ATTR_USER_AUTH_INPUT_DEVICE Y Y
287 SCARD_ATTR_USER_TO_CARD_AUTH_DEVICE Y Y
288 SCARD_ATTR_VENDOR_IFD_SERIAL_NO Y Y
289 SCARD_ATTR_VENDOR_IFD_TYPE Y Y
290 SCARD_ATTR_VENDOR_IFD_VERSION Y Y
291 SCARD_ATTR_VENDOR_NAME Y Y
292 ======================================== ======= =======
293
294 Not all the dwAttrId values listed above may be implemented in the IFD
295 Handler you are using. And some dwAttrId values not listed here may be
296 implemented.
297
298
299 from smartcard.scard import *
300 ... establish context and connect to card ...
301 hresult, attrib = SCardGetAttrib(hcard, SCARD_ATTR_ATR_STRING)
302 if hresult == SCARD_S_SUCCESS:
303 for j in attrib:
304 print '0x%.2X' % attrib,
305 ...
306
307 """
308 return _scard.SCardGetAttrib(hcard, dwAttrId)
309
311 """
312 SCardSetAttrib( hcard, dwAttrId, BYTELIST * ATTRIBUTESIN) -> SCARDRETCODE
313
314 Parameters
315 ----------
316 hcard: card handle return from SCardConnect()
317 dwAttrId: value of attribute to get
318 ATTRIBUTESIN: BYTELIST *
319
320
321
322
323 This function sets an attribute from the IFD Handler. Not all
324 attributes are supported by all readers nor can they be set at all
325 times.
326
327 The possible attributes are:
328
329 ======================================== ======= =======
330 Attribute Windows PSCS
331 lite
332 ======================================== ======= =======
333 SCARD_ATTR_ASYNC_PROTOCOL_TYPES Y
334 SCARD_ATTR_ATR_STRING Y Y
335 SCARD_ATTR_CHANNEL_ID Y Y
336 SCARD_ATTR_CHARACTERISTICS Y Y
337 SCARD_ATTR_CURRENT_BWT Y Y
338 SCARD_ATTR_CURRENT_CLK Y Y
339 SCARD_ATTR_CURRENT_CWT Y Y
340 SCARD_ATTR_CURRENT_D Y Y
341 SCARD_ATTR_CURRENT_EBC_ENCODING Y Y
342 SCARD_ATTR_CURRENT_F Y Y
343 SCARD_ATTR_CURRENT_IFSC Y Y
344 SCARD_ATTR_CURRENT_IFSD Y Y
345 SCARD_ATTR_CURRENT_IO_STATE Y Y
346 SCARD_ATTR_CURRENT_N Y Y
347 SCARD_ATTR_CURRENT_PROTOCOL_TYPE Y Y
348 SCARD_ATTR_CURRENT_W Y Y
349 SCARD_ATTR_DEFAULT_CLK Y Y
350 SCARD_ATTR_DEFAULT_DATA_RATE Y Y
351 SCARD_ATTR_DEVICE_FRIENDLY_NAME_A Y Y
352 SCARD_ATTR_DEVICE_FRIENDLY_NAME_W Y Y
353 SCARD_ATTR_DEVICE_IN_USE Y Y
354 SCARD_ATTR_DEVICE_SYSTEM_NAME_A Y Y
355 SCARD_ATTR_DEVICE_SYSTEM_NAME_W Y Y
356 SCARD_ATTR_DEVICE_UNIT Y Y
357 SCARD_ATTR_ESC_AUTHREQUEST Y Y
358 SCARD_ATTR_ESC_CANCEL Y Y
359 SCARD_ATTR_ESC_RESET Y Y
360 SCARD_ATTR_EXTENDED_BWT Y Y
361 SCARD_ATTR_ICC_INTERFACE_STATUS Y Y
362 SCARD_ATTR_ICC_PRESENCE Y Y
363 SCARD_ATTR_ICC_TYPE_PER_ATR Y Y
364 SCARD_ATTR_MAXINPUT Y Y
365 SCARD_ATTR_MAX_CLK Y Y
366 SCARD_ATTR_MAX_DATA_RATE Y Y
367 SCARD_ATTR_MAX_IFSD Y Y
368 SCARD_ATTR_POWER_MGMT_SUPPORT Y Y
369 SCARD_ATTR_SUPRESS_T1_IFS_REQUEST Y Y
370 SCARD_ATTR_SYNC_PROTOCOL_TYPES Y
371 SCARD_ATTR_USER_AUTH_INPUT_DEVICE Y Y
372 SCARD_ATTR_USER_TO_CARD_AUTH_DEVICE Y Y
373 SCARD_ATTR_VENDOR_IFD_SERIAL_NO Y Y
374 SCARD_ATTR_VENDOR_IFD_TYPE Y Y
375 SCARD_ATTR_VENDOR_IFD_VERSION Y Y
376 SCARD_ATTR_VENDOR_NAME Y Y
377 ======================================== ======= =======
378
379 Not all the dwAttrId values listed above may be implemented in the IFD
380 Handler you are using. And some dwAttrId values not listed here may be
381 implemented.
382
383
384 from smartcard.scard import *
385 ... establish context and connect to card ...
386 hresult, attrib = SCardSetAttrib(hcard, SCARD_ATTR_VENDOR_NAME, ['G', 'e', 'm', 'a', 'l', 't', 'o'])
387 if hresult != SCARD_S_SUCCESS:
388 print 'Failed to set attribute'
389 ...
390
391 """
392 return _scard.SCardSetAttrib(hcard, dwAttrId, ATTRIBUTESIN)
393
395 """
396 SCardControl( hcard, dwControlCode, byte[] inbuffer) -> SCARDRETCODE
397
398 Parameters
399 ----------
400 hcard: card handle return from SCardConnect()
401 dwControlCode: the control code to send
402 inbuffer: list of bytes to send with the control code
403
404
405
406 This function sends a control command to the reader connected to by
407 SCardConnect(). It returns a result and the control response.
408
409
410 from smartcard.scard import *
411 hresult, hcontext = SCardEstablishContext(SCARD_SCOPE_USER)
412 hresult, hcard, dwActiveProtocol = SCardConnect(
413 hcontext, 'SchlumbergerSema Reflex USB v.2 0', SCARD_SHARE_SHARED, SCARD_PROTOCOL_T0)
414 CMD = [0x12, 0x34]
415 hresult, response = SCardControl(hcard, 42, CMD)
416 if hresult != SCARD_S_SUCCESS:
417 raise error, 'Failed to control: ' + SCardGetErrorMessage(hresult)
418
419 """
420 return _scard.SCardControl(hcard, dwControlCode, inbuffer)
421
423 """
424 SCardBeginTransaction( hcard) -> SCARDRETCODE
425
426 Parameters
427 ----------
428 hcard: card handle return from SCardConnect()
429
430
431
432 This function establishes a temporary exclusive access mode for doing a
433 series of commands or transaction. You might want to use this when you
434 are selecting a few files and then writing a large file so you can make
435 sure that another application will not change the current file. If
436 another application has a lock on this reader or this application is in
437 SCARD_SHARE_EXCLUSIVE there will be no action taken.
438
439 from smartcard.scard import *
440 ... establish context ...
441 hresult, hcard, dwActiveProtocol = SCardConnect(
442 hcontext, 'SchlumbergerSema Reflex USB v.2 0', SCARD_SHARE_SHARED, SCARD_PROTOCOL_T0)
443 if hresult!=SCARD_S_SUCCESS:
444 raise error, 'unable to connect: ' + SCardGetErrorMessage(hresult)
445 hresult = SCardBeginTransaction(hcard)
446 if hresult != SCARD_S_SUCCESS:
447 raise error, 'failed to begin transaction: ' + SCardGetErrorMessage(hresult)
448 ...
449
450 """
451 return _scard.SCardBeginTransaction(hcard)
452
454 """
455 SCardCancel( hcontext) -> SCARDRETCODE
456
457 Parameters
458 ----------
459 hcontext: context handle return from SCardEstablishContext()
460
461
462
463 This function cancels all pending blocking requests on the
464 ScardGetStatusChange() function.
465
466 from smartcard.scard import *
467 ... establish context ...
468 hresult = SCardCancel(hcard)
469 if hresult != SCARD_S_SUCCESS:
470 raise error, 'failed to cancel pending actions: ' + SCardGetErrorMessage(hresult)
471 ...
472 """
473 return _scard.SCardCancel(hcontext)
474
475 -def SCardConnect(hcontext, readername, dwShareMode, dwPreferredProtocols):
476 """
477 SCardConnect( hcontext, readername, dwShareMode, dwPreferredProtocols) -> SCARDRETCODE
478
479 Parameters
480 ----------
481 hcontext: context handle return from SCardEstablishContext()
482 readername: card reader name
483 dwShareMode: share mode
484 dwPreferredProtocols: preferred protocols
485
486
487
488 This function establishes a connection to the friendly name of the reader
489 specified in szReader. The first connection will power up and perform a
490 reset on the card.
491
492 Value of dwShareMode Meaning
493 SCARD_SHARE_SHARED This application will allow others to share the reader
494 SCARD_SHARE_EXCLUSIVE This application will NOT allow others to share the reader
495 SCARD_SHARE_DIRECT Direct control of the reader, even without a card
496
497 SCARD_SHARE_DIRECT can be used before using SCardControl() to send control
498 commands to the reader even if a card is not present in the reader.
499
500 Value of dwPreferredProtocols Meaning
501 SCARD_PROTOCOL_T0 Use the T=0 protocol
502 SCARD_PROTOCOL_T1 Use the T=1 protocol
503 SCARD_PROTOCOL_RAW Use with memory type cards
504
505 from smartcard.scard import *
506 ... establish context ...
507 hresult, readers = SCardListReaders(hcontext, 'NULL')
508 if hresult != SCARD_S_SUCCESS:
509 raise error, 'Failed to list readers:: ' + SCardGetErrorMessage(hresult)
510 hresult, hcard, dwActiveProtocol = SCardConnect(
511 hcontext, readers[0], SCARD_SHARE_SHARED, SCARD_PROTOCOL_T0)
512 if hresult != SCARD_S_SUCCESS:
513 raise error, 'unable to connect: ' + SCardGetErrorMessage(hresult)
514 ...
515
516 """
517 return _scard.SCardConnect(hcontext, readername, dwShareMode, dwPreferredProtocols)
518
520 """
521 SCardDisconnect( hcard, dwDisposition) -> SCARDRETCODE
522
523 Parameters
524 ----------
525 hcard: card handle return from SCardConnect()
526 dwDisposition: card disposition on return
527
528
529
530 This function terminates a connection to the connection made through
531 SCardConnect. disposition can have the following values:
532
533 Value of disposition Meaning
534 SCARD_LEAVE_CARD Do nothing
535 SCARD_RESET_CARD Reset the card (warm reset)
536 SCARD_UNPOWER_CARD Unpower the card (cold reset)
537 SCARD_EJECT_CARD Eject the card
538
539 from smartcard.scard import *
540 ... establish context and connect to card ...
541 hresult = SCardDisconnect(hcard, SCARD_UNPOWER_CARD)
542 if hresult != SCARD_S_SUCCESS:
543 raise error, 'failed to disconnect: ' + SCardGetErrorMessage(hresult)
544 ...
545
546 """
547 return _scard.SCardDisconnect(hcard, dwDisposition)
548
550 """
551 SCardEndTransaction( hcard, dwDisposition) -> SCARDRETCODE
552
553 Parameters
554 ----------
555 hcard: card handle return from SCardConnect()
556 dwDisposition: card disposition on return
557
558
559
560
561 This function ends a previously begun transaction. The calling
562 application must be the owner of the previously begun transaction or an
563 error will occur. disposition can have the following values: The
564 disposition action is not currently used in this release.
565
566 Value of disposition Meaning
567 SCARD_LEAVE_CARD Do nothing
568 SCARD_RESET_CARD Reset the card
569 SCARD_UNPOWER_CARD Unpower the card
570 SCARD_EJECT_CARD Eject the card
571
572 from smartcard.scard import *
573 ... establish context, connect to card, begin transaction ...
574 hresult = SCardEndTransaction(hcard, SCARD_LEAVE_CARD)
575 if hresult != SCARD_S_SUCCESS:
576 raise error, 'failed to end transaction: ' + SCardGetErrorMessage(hresult)
577
578 """
579 return _scard.SCardEndTransaction(hcard, dwDisposition)
580
582 """
583 SCardEstablishContext( dwScope) -> SCARDRETCODE
584
585 Parameters
586 ----------
587 dwScope: context scope
588
589
590
591 This function creates a communication context to the PC/SC Resource
592 Manager. This must be the first function called in a PC/SC application.
593
594 Value of dwScope Meaning
595 SCARD_SCOPE_USER Operations performed within the scope of the User
596 SCARD_SCOPE_TERMINAL Not used
597 SCARD_SCOPE_GLOBAL Not used
598 SCARD_SCOPE_SYSTEM Operations performed within the scope of the system
599
600
601 from smartcard.scard import *
602 hresult, hcontext = SCardEstablishContext(SCARD_SCOPE_USER)
603 if hresult != SCARD_S_SUCCESS:
604 raise error, 'Failed to establish context: ' + SCardGetErrorMessage(hresult)
605
606 """
607 return _scard.SCardEstablishContext(dwScope)
608
610 """
611 SCardGetStatusChange( hcontext, dwTimeout, tuple[] readerstatelist) -> SCARDRETCODE
612
613 Parameters
614 ----------
615 hcontext: context handle return from SCardEstablishContext()
616 dwTimeout: timeout value, INFINITE for infinite time-out
617 readerstatelist: in input/output, a list of reader state tuple (readername, state, atr)
618
619
620
621
622 This function receives a structure or list of tuples containing reader
623 states. A READERSTATE hast three fields (readername, state, atr).
624 It then blocks for a change in state to occur on any of the OR'd
625 values contained in the current state for a maximum blocking time of
626 dwTimeout or forever if INFINITE is used. The new event state will be
627 contained in state. A status change might be a card insertion or
628 removal event, a change in ATR, etc.
629
630 Value of state Meaning
631 SCARD_STATE_UNAWARE The application is unaware of the current state, and would like to know. The use of this value results in an immediate return from state transition monitoring services. This is represented by all bits set to zero
632 SCARD_STATE_IGNORE This reader should be ignored
633 SCARD_STATE_CHANGED There is a difference between the state believed by the application, and the state known by the resource manager. When this bit is set, the application may assume a significant state change has occurred on this reader
634 SCARD_STATE_UNKNOWN The given reader name is not recognized by the resource manager. If this bit is set, then SCARD_STATE_CHANGED and SCARD_STATE_IGNORE will also be set
635 SCARD_STATE_UNAVAILABLE The actual state of this reader is not available. If this bit is set, then all the following bits are clear
636 SCARD_STATE_EMPTY There is no card in the reader. If this bit is set, all the following bits will be clear
637 SCARD_STATE_PRESENT There is a card in the reader
638 SCARD_STATE_ATRMATCH There is a card in the reader with an ATR matching one of the target cards. If this bit is set, SCARD_STATE_PRESENT will also be set. This bit is only returned on the SCardLocateCards function
639 SCARD_STATE_EXCLUSIVE The card in the reader is allocated for exclusive use by another application. If this bit is set, SCARD_STATE_PRESENT will also be set
640 SCARD_STATE_INUSE The card in the reader is in use by one or more other applications, but may be connected to in shared mode. If this bit is set, SCARD_STATE_PRESENT will also be set
641 SCARD_STATE_MUTE There is an unresponsive card in the reader
642
643
644 from smartcard.scard import *
645 hresult, hcontext = SCardEstablishContext(SCARD_SCOPE_USER)
646 hresult, readers = SCardListReaders(hcontext, [])
647 readerstates = []
648 cards = [ 'Schlumberger Cryptoflex 4k', 'Schlumberger Cryptoflex 8k', 'Schlumberger Cryptoflex 8k v2' ]
649 for i in xrange(len(readers)):
650 readerstates += [ (readers[i], SCARD_STATE_UNAWARE) ]
651 hresult, newstates = SCardLocateCards(hcontext, cards, readerstates)
652 print '----- Please insert or remove a card ------------'
653 hresult, newstates = SCardGetStatusChange(hcontext, INFINITE, newstates)
654 for i in newstates
655 reader, eventstate, atr = i
656 if eventstate & SCARD_STATE_ATRMATCH:
657 print ' Card found'
658 if eventstate & SCARD_STATE_EMPTY:
659 print ' Reader empty'
660
661 """
662 return _scard.SCardGetStatusChange(hcontext, dwTimeout, readerstatelist)
663
665 """
666 SCardListReaders( hcontext, [] readergroups) -> SCARDRETCODE
667
668 Parameters
669 ----------
670 hcontext: context handle return from SCardEstablishContext()
671 readergroups: a list of reader groups to search for readers
672
673
674
675 This function returns a list of currently available readers on the system.
676 A list of group can be provided in input to list readers in a given
677 group only.
678
679 from smartcard.scard import *
680 hresult, hcontext = SCardEstablishContext(SCARD_SCOPE_USER)
681 hresult, readers = SCardListReaders(hcontext, [])
682 if hresult != SCARD_S_SUCCESS:
683 raise error, 'Failed to list readers: ' + SCardGetErrorMessage(hresult)
684 print 'PCSC Readers: ', readers
685 hresult, readers = SCardListReaders(hcontext, ['SCard$T1ProtocolReaders', 'SCard$MyOwnGroup']
686 ...
687
688 """
689 return _scard.SCardListReaders(hcontext, readergroups)
690
692 """
693 SCardListReaderGroups( hcontext) -> SCARDRETCODE
694
695 Parameters
696 ----------
697 hcontext: context handle return from SCardEstablishContext()
698
699
700
701 This function returns a list of currently available reader groups on the
702 system.
703
704 from smartcard.scard import *
705 hresult, hcontext = SCardEstablishContext(SCARD_SCOPE_USER)
706 hresult, readerGroups = SCardListReaderGroups(hcontext)
707 if hresult != SCARD_S_SUCCESS:
708 raise error, 'Unable to list reader groups: ' + SCardGetErrorMessage(hresult)
709 print 'PCSC Reader groups: ', readerGroups
710
711 """
712 return _scard.SCardListReaderGroups(hcontext)
713
714 -def SCardReconnect(hcard, dwShareMode, dwPreferredProtocols, dwInitialization):
715 """
716 SCardReconnect( hcard, dwShareMode, dwPreferredProtocols, dwInitialization) -> SCARDRETCODE
717
718 Parameters
719 ----------
720 hcard: card handle return from SCardConnect()
721 dwShareMode: share mode
722 dwPreferredProtocols: preferred protocols
723 dwInitialization: the type of initialization that should be performed on the card
724
725
726
727
728 This function reestablishes a connection to a reader that was previously
729 connected to using SCardConnect(). In a multi application environment it
730 is possible for an application to reset the card in shared mode. When
731 this occurs any other application trying to access certain commands will
732 be returned the value SCARD_W_RESET_CARD. When this occurs
733 SCardReconnect() must be called in order to acknowledge that the card was
734 reset and allow it to change it's state accordingly.
735
736 Value of dwShareMode Meaning
737 SCARD_SHARE_SHARED This application will allow others to share the reader
738 SCARD_SHARE_EXCLUSIVE This application will NOT allow others to share the reader
739
740 Value of dwPreferredProtocols Meaning
741 SCARD_PROTOCOL_T0 Use the T=0 protocol
742 SCARD_PROTOCOL_T1 Use the T=1 protocol
743 SCARD_PROTOCOL_RAW Use with memory type cards
744
745 dwPreferredProtocols is a bit mask of acceptable protocols for the connection. You can use (SCARD_PROTOCOL_T0 | SCARD_PROTOCOL_T1) if you do not have a preferred protocol.
746
747 Value of dwInitialization Meaning
748 SCARD_LEAVE_CARD Do nothing
749 SCARD_RESET_CARD Reset the card (warm reset)
750 SCARD_UNPOWER_CARD Unpower the card (cold reset)
751 SCARD_EJECT_CARD Eject the card
752
753
754 from smartcard.scard import *
755 hresult, hcontext = SCardEstablishContext(SCARD_SCOPE_USER)
756 hresult, hcard, dwActiveProtocol = SCardConnect(
757 hcontext, 'SchlumbergerSema Reflex USB v.2 0', SCARD_SHARE_SHARED, SCARD_PROTOCOL_T0)
758 hresult, activeProtocol = SCardReconnect(hcard, SCARD_SHARE_EXCLUSIVE,
759 SCARD_PROTOCOL_T0, SCARD_RESET_CARD)
760 ...
761
762 """
763 return _scard.SCardReconnect(hcard, dwShareMode, dwPreferredProtocols, dwInitialization)
764
766 """
767 SCardReleaseContext( hcontext) -> SCARDRETCODE
768
769 Parameters
770 ----------
771 hcontext: context handle return from SCardEstablishContext()
772
773
774
775
776 """
777 return _scard.SCardReleaseContext(hcontext)
778
780 """
781 SCardStatus( hcard) -> SCARDRETCODE
782
783 Parameters
784 ----------
785 hcard: card handle return from SCardConnect()
786
787
788
789 This function returns the current status of the reader connected to by
790 hcard. The reader friendly name is returned, as well as the state,
791 protocol and ATR. The state is a DWORD possibly OR'd with the following
792 values:
793
794 Value of pdwState Meaning
795 SCARD_ABSENT There is no card in the reader
796 SCARD_PRESENT There is a card in the reader, but it has not been moved into position for use
797 SCARD_SWALLOWED There is a card in the reader in position for use. The card is not powered
798 SCARD_POWERED Power is being provided to the card, but the reader driver is unaware of the mode of the card
799 SCARD_NEGOTIABLE The card has been reset and is awaiting PTS negotiation
800 SCARD_SPECIFIC The card has been reset and specific communication protocols have been established
801
802 Value of pdwProtocol Meaning
803 SCARD_PROTOCOL_T0 Use the T=0 protocol
804 SCARD_PROTOCOL_T1 Use the T=1 protocol
805
806
807 from smartcard.scard import *
808 hresult, hcontext = SCardEstablishContext(SCARD_SCOPE_USER)
809 hresult, hcard, dwActiveProtocol = SCardConnect(
810 hcontext, 'SchlumbergerSema Reflex USB v.2 0', SCARD_SHARE_SHARED, SCARD_PROTOCOL_T0)
811 hresult, reader, state, protocol, atr = SCardStatus(hcard)
812 if hresult != SCARD_S_SUCCESS:
813 raise error, 'failed to get status: ' + SCardGetErrorMessage(hresult)
814 print 'Reader: ', reader
815 print 'State: ', state
816 print 'Protocol: ', protocol
817 print 'ATR: ',
818 for i in xrange(len(atr)):
819 print '0x%.2X' % i,
820 print
821 ...
822
823 """
824 return _scard.SCardStatus(hcard)
825
827 """
828 SCardTransmit( hcard, unsigned long pioSendPci, byte[] apducommand) -> SCARDRETCODE
829
830 Parameters
831 ----------
832 hcard: card handle return from SCardConnect()
833 pioSendPci: unsigned long
834 apducommand: list of APDU bytes to transmit
835
836
837
838 This function sends an APDU to the smart card contained in the reader
839 connected to by SCardConnect().
840 It returns a result and the card APDU response.
841
842 Value of pioSendPci Meaning
843 SCARD_PCI_T0 Pre-defined T=0 PCI structure
844 SCARD_PCI_T1 Pre-defined T=1 PCI structure
845
846
847 from smartcard.scard import *
848 hresult, hcontext = SCardEstablishContext(SCARD_SCOPE_USER)
849 hresult, hcard, dwActiveProtocol = SCardConnect(
850 hcontext, 'SchlumbergerSema Reflex USB v.2 0', SCARD_SHARE_SHARED, SCARD_PROTOCOL_T0)
851 SELECT = [0xA0, 0xA4, 0x00, 0x00, 0x02]
852 DF_TELECOM = [0x7F, 0x10]
853 hresult, response = SCardTransmit(hcard, SCARD_PCI_T0, SELECT + DF_TELECOM)
854 if hresult != SCARD_S_SUCCESS:
855 raise error, 'Failed to transmit: ' + SCardGetErrorMessage(hresult)
856
857 """
858 return _scard.SCardTransmit(hcard, pioSendPci, apducommand)
859
861 """
862 SCARD_CTL_CODE(long code) -> long
863
864 Parameters
865 ----------
866 code: long
867
868
869
870 This function returns the value of a control code
871
872 from smartcard.scard import *
873 ...
874 CM_IOCTL_GET_FEATURE_REQUEST = SCARD_CTL_CODE(3400)
875 ...
876
877 """
878 return _scard.SCARD_CTL_CODE(code)
879
881 """
882 SCardGetErrorMessage(long lErrCode) -> ERRORSTRING *
883
884 Parameters
885 ----------
886 lErrCode: long
887
888
889
890 This function return a human readable text for the given PC/SC error code.
891
892 from smartcard.scard import *
893 ...
894 hresult, response = SCardTransmit(hcard, SCARD_PCI_T0, SELECT + DF_TELECOM)
895 if hresult != SCARD_S_SUCCESS:
896 raise error, 'Failed to transmit: ' + SCardGetErrorMessage(hresult)
897 ...
898
899 """
900 return _scard.SCardGetErrorMessage(lErrCode)
901
902 error = _scard.error
903
904 SCARD_SCOPE_USER = _scard.SCARD_SCOPE_USER
905 SCARD_SCOPE_TERMINAL = _scard.SCARD_SCOPE_TERMINAL
906 SCARD_SCOPE_SYSTEM = _scard.SCARD_SCOPE_SYSTEM
907 SCARD_SHARE_SHARED = _scard.SCARD_SHARE_SHARED
908 SCARD_SHARE_EXCLUSIVE = _scard.SCARD_SHARE_EXCLUSIVE
909 SCARD_SHARE_DIRECT = _scard.SCARD_SHARE_DIRECT
910 SCARD_LEAVE_CARD = _scard.SCARD_LEAVE_CARD
911 SCARD_RESET_CARD = _scard.SCARD_RESET_CARD
912 SCARD_UNPOWER_CARD = _scard.SCARD_UNPOWER_CARD
913 SCARD_EJECT_CARD = _scard.SCARD_EJECT_CARD
914 SCARD_STATE_UNAWARE = _scard.SCARD_STATE_UNAWARE
915 SCARD_STATE_IGNORE = _scard.SCARD_STATE_IGNORE
916 SCARD_STATE_CHANGED = _scard.SCARD_STATE_CHANGED
917 SCARD_STATE_UNKNOWN = _scard.SCARD_STATE_UNKNOWN
918 SCARD_STATE_UNAVAILABLE = _scard.SCARD_STATE_UNAVAILABLE
919 SCARD_STATE_EMPTY = _scard.SCARD_STATE_EMPTY
920 SCARD_STATE_PRESENT = _scard.SCARD_STATE_PRESENT
921 SCARD_STATE_ATRMATCH = _scard.SCARD_STATE_ATRMATCH
922 SCARD_STATE_EXCLUSIVE = _scard.SCARD_STATE_EXCLUSIVE
923 SCARD_STATE_INUSE = _scard.SCARD_STATE_INUSE
924 SCARD_STATE_MUTE = _scard.SCARD_STATE_MUTE
925 SCARD_STATE_UNPOWERED = _scard.SCARD_STATE_UNPOWERED
926 SCARD_PROTOCOL_UNSET = _scard.SCARD_PROTOCOL_UNSET
927 SCARD_PROTOCOL_T0 = _scard.SCARD_PROTOCOL_T0
928 SCARD_PROTOCOL_T1 = _scard.SCARD_PROTOCOL_T1
929 SCARD_PROTOCOL_RAW = _scard.SCARD_PROTOCOL_RAW
930 SCARD_PROTOCOL_T15 = _scard.SCARD_PROTOCOL_T15
931 SCARD_PROTOCOL_ANY = _scard.SCARD_PROTOCOL_ANY
932 SCARD_PROTOCOL_UNDEFINED = _scard.SCARD_PROTOCOL_UNDEFINED
933 SCARD_PROTOCOL_OPTIMAL = _scard.SCARD_PROTOCOL_OPTIMAL
934 SCARD_PROTOCOL_Tx = _scard.SCARD_PROTOCOL_Tx
935 SCARD_PROTOCOL_DEFAULT = _scard.SCARD_PROTOCOL_DEFAULT
936 SCARD_PCI_T0 = _scard.SCARD_PCI_T0
937 SCARD_PCI_T1 = _scard.SCARD_PCI_T1
938 SCARD_PCI_RAW = _scard.SCARD_PCI_RAW
939 SCARD_ATTR_VENDOR_NAME = _scard.SCARD_ATTR_VENDOR_NAME
940 SCARD_ATTR_VENDOR_IFD_TYPE = _scard.SCARD_ATTR_VENDOR_IFD_TYPE
941 SCARD_ATTR_VENDOR_IFD_VERSION = _scard.SCARD_ATTR_VENDOR_IFD_VERSION
942 SCARD_ATTR_VENDOR_IFD_SERIAL_NO = _scard.SCARD_ATTR_VENDOR_IFD_SERIAL_NO
943 SCARD_ATTR_CHANNEL_ID = _scard.SCARD_ATTR_CHANNEL_ID
944 SCARD_ATTR_ASYNC_PROTOCOL_TYPES = _scard.SCARD_ATTR_ASYNC_PROTOCOL_TYPES
945 SCARD_ATTR_DEFAULT_CLK = _scard.SCARD_ATTR_DEFAULT_CLK
946 SCARD_ATTR_MAX_CLK = _scard.SCARD_ATTR_MAX_CLK
947 SCARD_ATTR_DEFAULT_DATA_RATE = _scard.SCARD_ATTR_DEFAULT_DATA_RATE
948 SCARD_ATTR_MAX_DATA_RATE = _scard.SCARD_ATTR_MAX_DATA_RATE
949 SCARD_ATTR_MAX_IFSD = _scard.SCARD_ATTR_MAX_IFSD
950 SCARD_ATTR_SYNC_PROTOCOL_TYPES = _scard.SCARD_ATTR_SYNC_PROTOCOL_TYPES
951 SCARD_ATTR_POWER_MGMT_SUPPORT = _scard.SCARD_ATTR_POWER_MGMT_SUPPORT
952 SCARD_ATTR_USER_TO_CARD_AUTH_DEVICE = _scard.SCARD_ATTR_USER_TO_CARD_AUTH_DEVICE
953 SCARD_ATTR_USER_AUTH_INPUT_DEVICE = _scard.SCARD_ATTR_USER_AUTH_INPUT_DEVICE
954 SCARD_ATTR_CHARACTERISTICS = _scard.SCARD_ATTR_CHARACTERISTICS
955 SCARD_ATTR_CURRENT_PROTOCOL_TYPE = _scard.SCARD_ATTR_CURRENT_PROTOCOL_TYPE
956 SCARD_ATTR_CURRENT_CLK = _scard.SCARD_ATTR_CURRENT_CLK
957 SCARD_ATTR_CURRENT_F = _scard.SCARD_ATTR_CURRENT_F
958 SCARD_ATTR_CURRENT_D = _scard.SCARD_ATTR_CURRENT_D
959 SCARD_ATTR_CURRENT_N = _scard.SCARD_ATTR_CURRENT_N
960 SCARD_ATTR_CURRENT_W = _scard.SCARD_ATTR_CURRENT_W
961 SCARD_ATTR_CURRENT_IFSC = _scard.SCARD_ATTR_CURRENT_IFSC
962 SCARD_ATTR_CURRENT_IFSD = _scard.SCARD_ATTR_CURRENT_IFSD
963 SCARD_ATTR_CURRENT_BWT = _scard.SCARD_ATTR_CURRENT_BWT
964 SCARD_ATTR_CURRENT_CWT = _scard.SCARD_ATTR_CURRENT_CWT
965 SCARD_ATTR_CURRENT_EBC_ENCODING = _scard.SCARD_ATTR_CURRENT_EBC_ENCODING
966 SCARD_ATTR_EXTENDED_BWT = _scard.SCARD_ATTR_EXTENDED_BWT
967 SCARD_ATTR_ICC_PRESENCE = _scard.SCARD_ATTR_ICC_PRESENCE
968 SCARD_ATTR_ICC_INTERFACE_STATUS = _scard.SCARD_ATTR_ICC_INTERFACE_STATUS
969 SCARD_ATTR_CURRENT_IO_STATE = _scard.SCARD_ATTR_CURRENT_IO_STATE
970 SCARD_ATTR_ATR_STRING = _scard.SCARD_ATTR_ATR_STRING
971 SCARD_ATTR_ICC_TYPE_PER_ATR = _scard.SCARD_ATTR_ICC_TYPE_PER_ATR
972 SCARD_ATTR_ESC_RESET = _scard.SCARD_ATTR_ESC_RESET
973 SCARD_ATTR_ESC_CANCEL = _scard.SCARD_ATTR_ESC_CANCEL
974 SCARD_ATTR_ESC_AUTHREQUEST = _scard.SCARD_ATTR_ESC_AUTHREQUEST
975 SCARD_ATTR_MAXINPUT = _scard.SCARD_ATTR_MAXINPUT
976 SCARD_ATTR_DEVICE_UNIT = _scard.SCARD_ATTR_DEVICE_UNIT
977 SCARD_ATTR_DEVICE_IN_USE = _scard.SCARD_ATTR_DEVICE_IN_USE
978 SCARD_ATTR_DEVICE_FRIENDLY_NAME_A = _scard.SCARD_ATTR_DEVICE_FRIENDLY_NAME_A
979 SCARD_ATTR_DEVICE_SYSTEM_NAME_A = _scard.SCARD_ATTR_DEVICE_SYSTEM_NAME_A
980 SCARD_ATTR_DEVICE_FRIENDLY_NAME_W = _scard.SCARD_ATTR_DEVICE_FRIENDLY_NAME_W
981 SCARD_ATTR_DEVICE_SYSTEM_NAME_W = _scard.SCARD_ATTR_DEVICE_SYSTEM_NAME_W
982 SCARD_ATTR_SUPRESS_T1_IFS_REQUEST = _scard.SCARD_ATTR_SUPRESS_T1_IFS_REQUEST
983 SCARD_ATTR_DEVICE_FRIENDLY_NAME = _scard.SCARD_ATTR_DEVICE_FRIENDLY_NAME
984 SCARD_ATTR_DEVICE_SYSTEM_NAME = _scard.SCARD_ATTR_DEVICE_SYSTEM_NAME
985 SCARD_S_SUCCESS = _scard.SCARD_S_SUCCESS
986 SCARD_F_INTERNAL_ERROR = _scard.SCARD_F_INTERNAL_ERROR
987 SCARD_E_CANCELLED = _scard.SCARD_E_CANCELLED
988 SCARD_E_INVALID_HANDLE = _scard.SCARD_E_INVALID_HANDLE
989 SCARD_E_INVALID_PARAMETER = _scard.SCARD_E_INVALID_PARAMETER
990 SCARD_E_INVALID_TARGET = _scard.SCARD_E_INVALID_TARGET
991 SCARD_E_NO_MEMORY = _scard.SCARD_E_NO_MEMORY
992 SCARD_F_WAITED_TOO_LONG = _scard.SCARD_F_WAITED_TOO_LONG
993 SCARD_E_INSUFFICIENT_BUFFER = _scard.SCARD_E_INSUFFICIENT_BUFFER
994 SCARD_E_UNKNOWN_READER = _scard.SCARD_E_UNKNOWN_READER
995 SCARD_E_TIMEOUT = _scard.SCARD_E_TIMEOUT
996 SCARD_E_SHARING_VIOLATION = _scard.SCARD_E_SHARING_VIOLATION
997 SCARD_E_NO_SMARTCARD = _scard.SCARD_E_NO_SMARTCARD
998 SCARD_E_UNKNOWN_CARD = _scard.SCARD_E_UNKNOWN_CARD
999 SCARD_E_CANT_DISPOSE = _scard.SCARD_E_CANT_DISPOSE
1000 SCARD_E_PROTO_MISMATCH = _scard.SCARD_E_PROTO_MISMATCH
1001 SCARD_E_NOT_READY = _scard.SCARD_E_NOT_READY
1002 SCARD_E_INVALID_VALUE = _scard.SCARD_E_INVALID_VALUE
1003 SCARD_E_SYSTEM_CANCELLED = _scard.SCARD_E_SYSTEM_CANCELLED
1004 SCARD_F_COMM_ERROR = _scard.SCARD_F_COMM_ERROR
1005 SCARD_F_UNKNOWN_ERROR = _scard.SCARD_F_UNKNOWN_ERROR
1006 SCARD_E_INVALID_ATR = _scard.SCARD_E_INVALID_ATR
1007 SCARD_E_NOT_TRANSACTED = _scard.SCARD_E_NOT_TRANSACTED
1008 SCARD_E_READER_UNAVAILABLE = _scard.SCARD_E_READER_UNAVAILABLE
1009 SCARD_E_PCI_TOO_SMALL = _scard.SCARD_E_PCI_TOO_SMALL
1010 SCARD_E_READER_UNSUPPORTED = _scard.SCARD_E_READER_UNSUPPORTED
1011 SCARD_E_DUPLICATE_READER = _scard.SCARD_E_DUPLICATE_READER
1012 SCARD_E_CARD_UNSUPPORTED = _scard.SCARD_E_CARD_UNSUPPORTED
1013 SCARD_E_NO_SERVICE = _scard.SCARD_E_NO_SERVICE
1014 SCARD_E_SERVICE_STOPPED = _scard.SCARD_E_SERVICE_STOPPED
1015 SCARD_E_NO_READERS_AVAILABLE = _scard.SCARD_E_NO_READERS_AVAILABLE
1016 SCARD_E_UNSUPPORTED_FEATURE = _scard.SCARD_E_UNSUPPORTED_FEATURE
1017 SCARD_W_UNSUPPORTED_CARD = _scard.SCARD_W_UNSUPPORTED_CARD
1018 SCARD_W_UNRESPONSIVE_CARD = _scard.SCARD_W_UNRESPONSIVE_CARD
1019 SCARD_W_UNPOWERED_CARD = _scard.SCARD_W_UNPOWERED_CARD
1020 SCARD_W_RESET_CARD = _scard.SCARD_W_RESET_CARD
1021 SCARD_W_REMOVED_CARD = _scard.SCARD_W_REMOVED_CARD
1022 SCARD_W_SECURITY_VIOLATION = _scard.SCARD_W_SECURITY_VIOLATION
1023 SCARD_W_WRONG_CHV = _scard.SCARD_W_WRONG_CHV
1024 SCARD_W_CHV_BLOCKED = _scard.SCARD_W_CHV_BLOCKED
1025 SCARD_W_EOF = _scard.SCARD_W_EOF
1026 SCARD_W_CANCELLED_BY_USER = _scard.SCARD_W_CANCELLED_BY_USER
1027 SCARD_W_CARD_NOT_AUTHENTICATED = _scard.SCARD_W_CARD_NOT_AUTHENTICATED
1028 SCARD_E_UNEXPECTED = _scard.SCARD_E_UNEXPECTED
1029 SCARD_E_ICC_INSTALLATION = _scard.SCARD_E_ICC_INSTALLATION
1030 SCARD_E_ICC_CREATEORDER = _scard.SCARD_E_ICC_CREATEORDER
1031 SCARD_E_DIR_NOT_FOUND = _scard.SCARD_E_DIR_NOT_FOUND
1032 SCARD_E_FILE_NOT_FOUND = _scard.SCARD_E_FILE_NOT_FOUND
1033 SCARD_E_NO_DIR = _scard.SCARD_E_NO_DIR
1034 SCARD_E_NO_FILE = _scard.SCARD_E_NO_FILE
1035 SCARD_E_NO_ACCESS = _scard.SCARD_E_NO_ACCESS
1036 SCARD_E_WRITE_TOO_MANY = _scard.SCARD_E_WRITE_TOO_MANY
1037 SCARD_E_BAD_SEEK = _scard.SCARD_E_BAD_SEEK
1038 SCARD_E_INVALID_CHV = _scard.SCARD_E_INVALID_CHV
1039 SCARD_E_UNKNOWN_RES_MNG = _scard.SCARD_E_UNKNOWN_RES_MNG
1040 SCARD_E_NO_SUCH_CERTIFICATE = _scard.SCARD_E_NO_SUCH_CERTIFICATE
1041 SCARD_E_CERTIFICATE_UNAVAILABLE = _scard.SCARD_E_CERTIFICATE_UNAVAILABLE
1042 SCARD_E_COMM_DATA_LOST = _scard.SCARD_E_COMM_DATA_LOST
1043 SCARD_E_NO_KEY_CONTAINER = _scard.SCARD_E_NO_KEY_CONTAINER
1044 SCARD_E_SERVER_TOO_BUSY = _scard.SCARD_E_SERVER_TOO_BUSY
1045 INVALID_HANDLE = _scard.INVALID_HANDLE
1046 SCARD_P_SHUTDOWN = _scard.SCARD_P_SHUTDOWN
1047 INFINITE = _scard.INFINITE
1048 resourceManager = _scard.resourceManager
1049 resourceManagerSubType = _scard.resourceManagerSubType
1050
1051