pcsc-lite is a Free Software implementation of the PC/SC (or WinSCard) API for Unix systems.
Changes:
1.8.20: Ludovic Rousseau
30 December 2016
- Fix a crash and potential security issue in
pcscd
I moved my blog from https://ludovicrousseau.blogspot.com/ to https://blog.apdu.fr/ . Why? I wanted to move away from Blogger (owne...
TB2, if present, is global. The usage of TB2 is deprecated since the 2006 edition of the standard, which prescribes that cards should not include TB2 in the ATR, and readers shall ignore TB2 if present.
In the 1997 edition of the standard, TB2 (8th to 1st bit) encode PI2, which when in range 50..250 (other values being RFU) encode VPP in increments of 0.1 V, and subsumes the coarser indication given by PI1 of TB1. Refer to that section for why modern Smart Cards have no use of VPP, and thus of TB2.
Historical note: Provision for TB2 did not exist in ISO/IEC 7816-3:1989, and was introduced because VPP = 12.5 V became a popular value in EEPROM technology, replacing 25 V and 21 V.
TB2 | # | % |
---|---|---|
2070 | 99.90 % | |
0x3F | 1 | 0.05 % |
0x45 | 1 | 0.05 % |
Interface byte TA2, if present, is global, and is named the specific mode byte.
Presence of TA2 commands that the reader use specific mode as defined by TA2 and earlier global bytes, rather than negotiable mode when TA2 is absent.
TA2 encodes in its 4 low-order bits an integer T defining the protocol required by the card, in the convention used for TD1 (EMV prescribes that a card which T encoded in TA2 does not match that in TD1 shall be rejected).
The 5th bit is 0 to encodes that the required ETU duration is Fi/Di clock cycles as defined by TA1 (or its default value if absent); or 1 to indicate that the ETU duration is implicitly known (by some convention, or setting of the reader; EMV prescribes that such card shall be rejected).
The 6th and 7th bit are reserved for future use; 0 indicates not used.
The 8th bit is 1 to indicate that the card is unable to change the negotiable/specific mode (that is, does not propose other settings); or 0 to indicate that card has that ability (perhaps after a warm ATR).
Historical note: Provision for specific mode did not exist in ISO/IEC 7816-3:1989. Back then, the interface character TA2 had no particular name or function, and was specific (to the protocol introduced by TD1). ISO/IEC 7816-3:1997 introduced the specific mode and the specific mode byte, with interim note helping cards with specific mode byte TA2 in their ATR dealing with a reader that did not implement specific mode.
TA2 | # | % |
---|---|---|
1983 | 95.70 % | |
0x81 | 48 | 2.32 % |
0x80 | 31 | 1.50 % |
0x00 | 10 | 0.48 % |
SCardGetStatusChange()
: Fix a (rare) race conditionSCardGetStatusChange()
may return SCARD_E_UNKNOWN_READER
SCardConnect()
and SCardReconnect()
will never return SCARD_E_NOT_READY
pam_smartcard(8) BSD System Manager's Manual pam_smartcard(8) NAME pam_smartcard -- Smartcard PAM module SYNOPSIS [service-name] function-class control-flag pam_smartcard [options] DESCRIPTION The Smartcard PAM module supports authentication function class. In terms of the function-class parameter, this is ``auth.'' The Smartcard Authentication Module This module permits or denies users based on smartcard authentication support in the Open Directory database, and the presence of an appropri- ate smartcard in the reader attached to the local machine. When a card is locked, the user is asked to unlock it with his PIN. The following options may be passed to this account management module: no_check_shell Continues evaluation even if user's shell is not valid. Normally, users with a shell like /usr/bin/false are considered as dis- abled. EXAMPLE Adding the following line on the top of the /etc/pam.d/sudo enables smartcard support for sudo: auth sufficient pam_smartcard.so SEE ALSO pam.conf(5), pam(8) SmartCardServices(7) BSD August 27, 2015 BSD
$ grep pam_smartcard /etc/pam.d/* /etc/pam.d/authorization_ctk:auth required pam_smartcard.so use_first_pass /etc/pam.d/screensaver_ctk:auth required pam_smartcard.so use_first_pass
$ cat /etc/pam.d/authorization_ctk
# ctk: auth
auth required pam_smartcard.so use_first_pass
account required pam_opendirectory.so
$ cat /etc/pam.d/screensaver_ctk
# ctk: auth
auth required pam_smartcard.so use_first_pass
account required pam_opendirectory.so
account sufficient pam_self.so
account required pam_group.so no_warn group=admin,wheel fail_safe
account required pam_group.so no_warn deny group=admin,wheel ruser fail_safe
SmartCardServices(7) BSD Miscellaneous Information Manual SmartCardServices(7) NAME SmartCardServices -- overview of smart card support DESCRIPTION SmartCardServices is a set of components for OS X smart card support. Any smart card which supports the PIV standard is supported natively by OS X. Access to smart card items is possible using the keychain inter- face. Applications can install additional drivers for smart cards that are not natively supported. Smart card certificates are automatically added to user's keychain when a smart card is inserted. Smart card certificates can be listed with security using the list-smartcards or export-smartcard commands. Keychain Access GUI cannot be used to manipulate or list these certificates. SETUP To associate users with smart cards, the system can be set up for either fixed key mapping or attribute based mapping. For fixed key use sc_auth(8) or use the dialog which appears automatically when an unasso- ciated smartcard is inserted into a reader. This dialog can be globally suppressed by: sudo defaults write /Library/Preferences/com.apple.security.smartcard UserPairing -bool NO Attribute matching can be set up using the appropriate AttributeMapping section in the configuration file as described below. There is no default configuration. If no AttributeMapping exists or the configuration file is missing, attribute matching is not used. If both fixed key mapping and attribute mapping are able to associate the inserted smart card with a user, attribute mapping takes precedence. By default certificates do not need to be trusted to allow association. Certificate trust can be globally enforced by setting: sudo defaults write /Library/Preferences/com.apple.security.smartcard checkCertificateTrust -bool YES [...]
SecurityTokend-55111/SecurityTokend.xcodeproj/project.pbxproj | 6 ++++++ SecurityTokend-55111/lib/transition.cpp | 1 + SecurityTokend-55111/security_tokend_client/transition.cpp | 1 + 3 files changed, 8 insertions(+)
OS X Version | SmartcardCCID | CCID |
---|---|---|
10.11 | SmartcardCCID-55008 | 1.4.14 |
10.11.1 | SmartcardCCID-55008 | 1.4.14 |
10.11.2 | SmartcardCCID-55008.20.1 | 1.4.20 |
10.11.3 | SmartcardCCID-55008.20.1 | 1.4.20 |
10.11.4 | SmartcardCCID-55008.40.1 | 1.4.21 |
10.11.5 | SmartcardCCID-55008.40.1 | 1.4.21 |
10.11.6 | SmartcardCCID-55008.40.1 | 1.4.21 |
System | Duration | Total amount | Mean |
---|---|---|---|
Flattr | 6 years | 100.27 € | 16.71 €/year |
Bitcoin | 2 years | 19.37 € | 9.67 €/year |
Bonne nouvelle ! Votre compte répond aux critères requis pour bénéficier du traitement AdSense accéléré.
Vous devriez pouvoir gagner jusqu'à 10,18 € par mois*. Faites en sorte que votre blog vienne grossir les rangs de ces millions d'autres qui rapportent de l'argent grâce à AdSense. S'inscrire
*Les revenus mentionnés ne sont que des estimations basées sur le trafic récemment enregistré par votre blog. Nous ne pouvons en garantir le montant. Les comptes et les revenus AdSense doivent également respecter le Règlement du programme et les Conditions d'utilisation AdSense.
Interfaces bytes TDi for i≥1, if present, are structural.
TDi encodes in its 4 high-order bits the presence of at most 4 other interface bytes: TAi+1 (resp. TBi+1, TCi+1, TDi+1) follow, in that order, if the 5th (resp. 6th, 7th, 8th) bit of TDi is 1.
TDi encodes in its 4 low-order bits (4th MSbit to 1st LSbit) an integer T, in range [0..15]. T = 15 is invalid in TD1, and in other TDi qualifies the following TAi+1 TBi+1, TCi+1, TDi+1 (if present) as global interface bytes. Other values of T indicates a protocol that the card is willing to use, and that TAi+1 TBi+1, TCi+1, TDi+1 (if present) are specific interface bytes applying only to that protocol. T = 0 is a character-oriented protocol. T = 1 is a block-oriented protocol. T in the range [3..14] is RFU.
Historical note: provision for dynamically qualifying interface bytes as global using T = 15 did not exist in ISO/IEC 7816-3:1989.
TD1 | # | % |
---|---|---|
899 | 43.39 % | |
0x80 | 459 | 22.15 % |
0x81 | 372 | 17.95 % |
0x40 | 95 | 4.58 % |
0x00 | 69 | 3.33 % |
0x91 | 46 | 2.22 % |
0xC0 | 45 | 2.17 % |
0xC1 | 27 | 1.30 % |
0x10 | 22 | 1.06 % |
0x50 | 16 | 0.77 % |
0x01 | 9 | 0.43 % |
0x0E | 8 | 0.39 % |
0x11 | 2 | 0.10 % |
0x1F | 1 | 0.05 % |
0x31 | 1 | 0.05 % |
0x3F | 1 | 0.05 % |
The type T refers to a transmission protocol and/or qualifies interface bytes.
- T=0 refers to the half-duplex transmission of characters specified in clause 10.
- T=1 refers to the half-duplex transmission of blocks specified in clause 11.
- T=2 and T=3 are reserved for future full-duplex operations.
- T=4 is reserved for an enhanced half-duplex transmission of characters.
- T=5 to T=13 are reserved for future use by ISO/IEC JTC 1/SC 17.
- T=14 refers to transmission protocols not standardized by ISO/IEC JTC 1/SC 17.
- T=15 does not refer to a transmission protocol, but only qualifies global interface bytes.
$ /usr/local/sbin/pcscd --version pcsc-lite version 1.8.18. Copyright (C) 1999-2002 by David Corcoran <corcoran musclecard.com>. Copyright (C) 2001-2015 by Ludovic Rousseau <ludovic .rousseau="" free.fr>. Copyright (C) 2003-2004 by Damien Sauveron <sauveron labri.fr>. Report bugs to <pcsclite-muscle@lists.alioth.debian.org>. Enabled features: Linux x86_64-unknown-linux-gnu serial usb libudev usbdropdir=/usr/local/lib/pcsc/drivers ipcdir=/var/run/pcscd configdir=/usr/local/etc/reader.conf.d
$ sudo /usr/local/sbin/pcscd --foreground --debug 00000000 debuglog.c:289:DebugLogSetLevel() debug level=debug 00001975 configfile.l:358:DBGetReaderList() Parsing conf file: /usr/local/etc/reader.conf.d 00001005 pcscdaemon.c:655:main() pcsc-lite 1.8.18 daemon ready. libudev: udev_monitor_enable_receiving: bind failed: Invalid argument 00005302 hotplug_libudev.c:758:HPRegisterForHotplugEvents() udev_monitor_enable_receiving() error: -1 ^C01658892 pcscdaemon.c:188:signal_thread() read failed: Interrupted system call
$ lsusb unable to initialize libusb: -99The libusb library is not usable.
$ strace lsusb [...] gettimeofday({1475313910, 750505}, NULL) = 0 openat(AT_FDCWD, "/dev/bus/usb", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/proc/bus/usb", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/dev", O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC) = 3 brk(0x1bfa000) = 0x1bfa000 getdents(3, /* 20 entries */, 32768) = 481 getdents(3, /* 0 entries */, 32768) = 0 brk(0x1bf2000) = 0x1bf2000 close(3) = 0 write(2, "unable to initialize libusb: -99"..., 33unable to initialize libusb: -99 ) = 33 exit_group(1) = ? +++ exited with 1 +++This is because the file system does not provide the USB virtual files in
$ ls -l /dev ls: cannot access /dev/lxss: Operation not permitted ls: /dev/random: Invalid argument total 0 drwxr-xr-x 2 root root 0 Oct 1 10:04 block lrwxrwxrwx 1 root root 13 Oct 1 10:04 fd -> /proc/self/fd crw------- 1 root root 0, 0 Oct 1 11:28 kmsg c????????? ? ? ? ? ? lxss crw-rw-rw- 1 root root 1, 3 Jan 1 1970 null crw-rw-rw- 0 root tty 5, 2 Oct 1 10:31 ptmx drwxr-xr-x 0 root root 0 Oct 1 10:04 pts crw-rw-rw- 1 root root 1, 8 Oct 1 11:28 random lrwxrwxrwx 1 root root 8 Oct 1 10:04 shm -> /run/shm lrwxrwxrwx 1 root root 15 Oct 1 10:04 stderr -> /proc/self/fd/2 lrwxrwxrwx 1 root root 15 Oct 1 10:04 stdin -> /proc/self/fd/0 lrwxrwxrwx 1 root root 15 Oct 1 10:04 stdout -> /proc/self/fd/1 crw------- 1 rousseau tty 4, 1 Oct 1 2016 tty crw-rw-rw- 1 root tty 4, 0 Oct 1 2016 tty0 crw------- 1 rousseau tty 4, 1 Oct 1 2016 tty1 crw-rw---- 1 root tty 4, 2 Oct 1 11:28 tty2 crw-rw-rw- 1 root root 1, 9 Oct 1 11:28 urandom crw-rw-rw- 1 root root 0, 0 Oct 1 11:28 zero
$ ls -l /proc total 0 dr-xr-xr-x 1 root root 0 Oct 1 10:07 1 dr-xr-xr-x 1 rousseau rousseau 0 Oct 1 10:07 2 dr-xr-xr-x 1 rousseau rousseau 0 Oct 1 11:29 22063 -r--r--r-- 1 root root 0 Oct 1 10:04 cmdline -r--r--r-- 1 root root 0 Oct 1 10:04 cpuinfo -r--r--r-- 1 root root 0 Oct 1 10:04 filesystems -r--r--r-- 1 root root 0 Oct 1 10:04 interrupts -r--r--r-- 1 root root 0 Oct 1 10:04 loadavg -r--r--r-- 1 root root 0 Oct 1 10:04 meminfo lrwxrwxrwx 1 root root 0 Oct 1 10:04 mounts -> self/mounts lrwxrwxrwx 1 root root 0 Oct 1 10:04 net -> self/net lrwxrwxrwx 1 root root 0 Oct 1 10:04 self -> 22063 -r--r--r-- 1 root root 0 Oct 1 10:04 stat dr-xr-xr-x 1 root root 0 Oct 1 10:04 sys -r--r--r-- 1 root root 0 Oct 1 10:04 uptime -r--r--r-- 1 root root 0 Oct 1 10:04 version
$ apt-cache policy libccid libccid: Installed: (none) Candidate: 1.4.15-1 Version table: 1.4.15-1 0 500 http://archive.ubuntu.com/ubuntu/ trusty/universe amd64 Packagess
$ pwd /var/cache/apt/archives $ sha1sum m4_1.4.17-2ubuntu1_amd64.deb 4358d262605ae065a7dc9b6e0c80b3c7f44bf1cc m4_1.4.17-2ubuntu1_amd64.deb
$ pwd /mnt/c/Users/Ludovic/Downloads $ sha1sum m4_1.4.17-2ubuntu1_amd64.deb 4358d262605ae065a7dc9b6e0c80b3c7f44bf1cc m4_1.4.17-2ubuntu1_amd64.deb
$ cat /etc/apt/sources.list deb http://archive.ubuntu.com/ubuntu trusty main restricted universe multiverse deb http://archive.ubuntu.com/ubuntu trusty-updates main restricted universe multiverse deb http://archive.ubuntu.com/ubuntu trusty-backports main restricted universe multiverse deb http://security.ubuntu.com/ubuntu trusty-security main restricted universe multiverse
$ dpkg --print-architecture amd64
This Linux-PAM login module allows a X.509 certificate based user login. The certificate and its dedicated private key are thereby accessed by means of an appropriate PKCS #11 module. For the verification of the users’ certificates, locally stored CA certificates as well as either online or locally accessible CRLs are used.
Support for Smart Card Driver Extensions
You can now createNSExtension
-based smart card drivers, allowing the contents of certain types of smart cards to be presented as part of the system keychain. This mechanism is intended to replace the deprecated Common Data Security Architecture, although for macOS 10.12, both architectures are supported.
The driver extensions are limited to read-only mode, so that it is not possible to alter the contents of a smart card using the standard keychain interface. For more information, see CryptoTokenKit Framework Reference.
$ cat /System/Library/Frameworks/PCSC.framework/Versions/A/Resources/version.plist <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>BuildAliasOf</key> <string>CryptoTokenKit</string> <key>BuildVersion</key> <string>65</string> <key>CFBundleShortVersionString</key> <string>8.0</string> <key>CFBundleVersion</key> <string>1</string> <key>ProjectName</key> <string>SmartCardServices</string> <key>SourceVersion</key> <string>196001003000000</string> </dict> </plist>The BuildVersion changed from 13 on El Capitan to 65 on Sierra, and SourceVersion changed from 79001001000000 to 196001003000000. I have no idea what the SourceVersion "number" is.
$ grep -A 1 CFBundleShortVersionString /usr/libexec/SmartCardServices/drivers/ifd-ccid.bundle/Contents/Info.plist <key>CFBundleShortVersionString</key> <string>1.4.24</string>You can have a look at the CCID README file to know what changes between version 1.4.21 and version 1.4.24.
TC1, if present, is global, and encodes the Extra Guard Time integer (N), from 0 to 255 (8th MSbit to 1st LSbit); otherwise, N = 0. N defines how much the Guard Time that the reader must apply varies from a baseline of 12 ETU (corresponding to 1 start bit, 8 data bits, 1 parity bit, and 2 stop bits; with the second stop bit possibly used for an error indication by the receiver under protocol T = 0). The Guard Time is the minimum delay between the leading edge of the previous character, and the leading edge of the next character sent.
Except when N is 255, the Guard Time is: GT = 12 ETU + R*N/f
where:
N = 255 has a protocol-dependent meaning: GT = 12 ETU during PPS (Protocol and Parameters Selection) and protocol T = 0, GT = 11 ETU under protocol T = 1 (corresponding to 1 start bit, 8 data bits, 1 parity bit, and 1 stop bit; with no error indication).
- f is the clock frequency being generated by the reader;
- R is some number of clock cycles, either:
- per ETU, R = F/D, if T = 15 is absent from the ATR;
- defined by TA1, R = Fi/Di (or its default value), if T = 15 is present in the ATR.
Except under protocol T = 1, the card transmits with a Guard Time of 12 ETU, irrespective of N. Under protocol T = 1, the Guard Time defined by N is also the Character Guard Time (CGT), and applies to card and reader for characters sent in the same direction.
Note: The reader remains bound by the Guard Time GT defined by N when other prescriptions specify another minimum delay between leading edges of characters in different directions, even when that minimum is lower than GT.
Historical note: ISO/IEC 7816-3:1989 only defined that N code the EGT as a number of ETU, the method now used when T = 15 is absent from the ATR. With this convention, cards that allow negotiation of a reduced number of clock cycles per ETU after PPS must also allow a proportionally reduced number of clock cycles for the EGT, which does not match with a common EGT motivation: account for delays before the card can receive the next character. The 1997 edition of the standard introduced that when T = 15 is present in the ATR, N code the EGT as a multiple of the number of clock cycles per ETU coded by TA1, making the EGT effectively independent of the number of clocks cycles per ETU negotiated, while maintaining compatibility with former readers at least if they did not change the number of clock cycles per ETU.
TC1 | # | % |
---|---|---|
910 | 43.92 % | |
0x00 | 792 | 38.22 % |
0xFF | 287 | 13.85 % |
0x02 | 29 | 1.40 % |
0x03 | 18 | 0.87 % |
0x01 | 15 | 0.72 % |
0x08 | 6 | 0.29 % |
0x05 | 4 | 0.19 % |
0x04 | 3 | 0.14 % |
0x0B | 2 | 0.10 % |
0x09 | 1 | 0.05 % |
0x10 | 1 | 0.05 % |
0x3F | 1 | 0.05 % |
0x64 | 1 | 0.05 % |
0x81 | 1 | 0.05 % |
0xFE | 1 | 0.05 % |
macOS forge hosted open source projects closely related to macOS.
Smart Card Services
The Smart Card Services project is comprised of several components which, when combined, provide the necessary abstraction layer and integration of smart cards into Apple’s CDSA implementation.
Support for Smart Card Driver Extensions
You can now createNSExtension
-based smart card drivers, allowing the contents of certain types of smart cards to be presented as part of the system keychain. This mechanism is intended to replace the deprecated Common Data Security Architecture, although for macOS 10.12, both architectures are supported.
The driver extensions are limited to read-only mode, so that it is not possible to alter the contents of a smart card using the standard keychain interface. For more information, see CryptoTokenKit Framework Reference.
$ cd foobar $ export GOPATH=$(pwd) $ go get github.com/ebfe/scard
$ go version go version go1.3.3 linux/amd64
package main import ( "fmt" "github.com/ebfe/scard" ) func main() { // Establish a PC/SC context context, err := scard.EstablishContext() if err != nil { fmt.Println("Error EstablishContext:", err) return } // Release the PC/SC context (when needed) defer context.Release() // List available readers readers, err := context.ListReaders() if err != nil { fmt.Println("Error ListReaders:", err) return } // Use the first reader reader := readers[0] fmt.Println("Using reader:", reader) // Connect to the card card, err := context.Connect(reader, scard.ShareShared, scard.ProtocolAny) if err != nil { fmt.Println("Error Connect:", err) return } // Disconnect (when needed) defer card.Disconnect(scard.LeaveCard) // Send select APDU var cmd_select = []byte{0x00, 0xa4, 0x04, 0x00, 0x0A, 0xA0, 0x00, 0x00, 0x00, 0x62, 0x03, 0x01, 0x0C, 0x06, 0x01} rsp, err := card.Transmit(cmd_select) if err != nil { fmt.Println("Error Transmit:", err) return } fmt.Println(rsp) // Send command APDU var cmd_command = []byte{0x00, 0x00, 0x00, 0x00} rsp, err = card.Transmit(cmd_command) if err != nil { fmt.Println("Error Transmit:", err) return } fmt.Println(rsp) for i := 0; i < len(rsp)-2; i++ { fmt.Printf("%c", rsp[i]) } fmt.Println() }
$ go run hello_world.go Using reader: Gemalto PC Twin Reader (70D7E2EE) 00 00 [144 0] [72 101 108 108 111 32 119 111 114 108 100 33 144 0] Hello world!
TB1, if present, is global. The usage of TB1 is deprecated since the 2006 edition of the standard, which prescribes that cards should not include TB1 in the ATR, and readers shall ignore TB1 if present. EMV still requires that the card includes TB1 = ‘00’, and that remains common practice; doing so explicitly indicates that the card does not use the dedicated contact C6 for the purpose of supplying a programming voltage (VPP) to the card; the cards might however use C6 for Standard or Proprietary Use (SPU), such as communicating with a NFC front end by the Single Wire Protocol (SWP). On the reader side, EMV requires making a warm ATR for cards with TB1 other than ‘00’ in the cold ATR, and handling any TB1 in a warm ATR as if it was ‘00’.
TB1 was previously indicating (coarsely) the programming voltage VPP and maximum programming current required by some cards on the dedicated contact C6 during programming of their EPROM memory. Modern Smart Cards internally generate the programming voltage for their EEPROM or Flash memory, and thus do not use VPP. In the 1997 and earlier editions of the standard:
- The low 5 bits of TB1 (5th MSbit to 1st LSbit) encode PI1; if TB2 is absent, PI1 = 0 indicates that the C6 contact (assigned to VPP) is not connected in the card; PI1 in range [5..25] encodes the value of VPP in Volt (the reader shall apply that voltage only on specific demand by the card, with a tolerance of 2.5%, up to the maximum programming current; and otherwise leave the C6 contact used for VPP within 5% of the VCC voltage, up to 20 mA); if TB2 is present, it supersedes the indication given by TB1 in the PI1 field, regarding VPP connection or voltage.
- The high bit of TB1 (8th bits) is reserved, shall be 0, and can be ignored by the reader.
- The 6th and 5th bits of TB1 encode the maximum programming current (assuming neither TB1 nor TB2 indicate that VPP is not connected in the card).
(#) This was 100 mA in ISO/IEC 7816-3:1989.
7th and 6th bits 00 01 10 11 Maximum programming current 25 mA 50 mA RFU(#) RFU
TB1 | # | % |
---|---|---|
0x00 | 1228 | 59.27 % |
776 | 37.45 % | |
0x25 | 61 | 2.94 % |
0x2F | 2 | 0.10 % |
0x35 | 2 | 0.10 % |
0x20 | 1 | 0.05 % |
0x3F | 1 | 0.05 % |
0xFF | 1 | 0.05 % |
lsusb
or my program parse to have more details.SCardDisconnect(..., SCARD_UNPOWER_CARD)
would power off the card, power it on again and 5 seconds later, if not used, power off the card.SCardDisconnect(..., SCARD_UNPOWER_CARD)
would not return before the power on succeeds. This operation takes time because the reader has to get the ATR from the card. The application specifically used SCARD_UNPOWER_CARD
so we can expect the card will not be used after that.SCardDisconnect(..., SCARD_UNPOWER_CARD)
is now much faster. I included some numbers in the patch commit message.SCardDisconnect(SCARD_UNPOWER_CARD)
in 61 msSCardDisconnect(SCARD_UNPOWER_CARD)
in 1.4 msSCardDisconnect(..., SCARD_UNPOWER_CARD)
is not always on the performance critical path of an application.SCardDisconnect()
: much faster with SCARD_UNPOWER_CARD
SCardConnect()
: Fix a possible duplicated hCard
context$ sloccount . SLOC Directory SLOC-by-Language (Sorted) 493 PIVToken objc=493 Totals grouped by language (dominant language first): objc: 493 (100.00%)
$ scloccunt --details . 227 objc PIVToken PIVToken/Token.m 162 objc PIVToken PIVToken/TokenSession.m 50 objc PIVToken PIVToken/NSData_Zip.m 14 objc PIVToken PIVToken/TokenSession.h 36 objc PIVToken PIVToken/Token.h 4 objc PIVToken PIVToken/NSData_Zip.h
" This sample demonstrates how to write an extension for CryptoTokenKit framework to support new types of SmartCards or any other cryptographic token. "
https://en.wikipedia.org/w/index.php?curid=50807596 |
Beta Software
This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.
SmartCard
branch.SCardEndTransaction()
issue with a SCARD_SHARE_EXCLUSIVE
connectionSCardGetAttrib()
: set pcbAttrLen
when buffer is too smallSCardGetAttrib()
pbAttr
can be NULLSCardGetAttrib()
*pcbAttrLen
contains the buffer sizeSCardGetAttrib
bugNoCardException
if SCARD_E_NO_SMARTCARD
SCardControl()
on Windows 7$ pwd
/usr/libexec/SmartCardServices/drivers
$ ls -lR ifd-ccid.bundle/
total 0
drwxr-xr-x 5 root wheel 170 23 mai 18:54 Contents
ifd-ccid.bundle//Contents:
total 24
-rw-r--r-- 1 root wheel 36860 21 déc 06:05 Info.plist
drwxr-xr-x 6 root wheel 204 23 mai 18:54 MacOS
-rw-r--r-- 1 root wheel 470 21 déc 06:05 version.plist
ifd-ccid.bundle//Contents/MacOS:
total 512
lrwxr-xr-x 1 root wheel 20 23 mai 18:52 libccid.dylib -> libccid.dylib.1.4.21
-rwxr-xr-x 1 root wheel 165888 17 sep 2015 libccid.dylib.1.4.14
-rwxr-xr-x 1 root wheel 166096 3 déc 07:33 libccid.dylib.1.4.20
-rwxr-xr-x 1 root wheel 166096 5 mai 08:02 libccid.dylib.1.4.21
SCARD_ATTR_VENDOR_IFD_SERIAL_NO
attribute size$ pwd /usr/libexec/SmartCardServices/drivers $ ls -lR ifd-ccid.bundle/ total 0 drwxr-xr-x 5 root wheel 170 23 mar 09:30 Contents ifd-ccid.bundle//Contents: total 24 -rw-r--r-- 1 root wheel 36860 21 déc 06:05 Info.plist drwxr-xr-x 6 root wheel 204 23 mar 09:30 MacOS -rw-r--r-- 1 root wheel 470 21 déc 06:05 version.plist ifd-ccid.bundle//Contents/MacOS: total 512 lrwxr-xr-x 1 root wheel 20 4 nov 2015 libccid.dylib -> libccid.dylib.1.4.14 -rwxr-xr-x 1 root wheel 165888 17 sep 2015 libccid.dylib.1.4.14 -rwxr-xr-x 1 root wheel 166096 3 déc 07:33 libccid.dylib.1.4.20 -rwxr-xr-x 1 root wheel 166096 12 mar 09:30 libccid.dylib.1.4.21
Engineering has determined that your bug report (26396810) is a duplicate of another issue (26328490) and will be closed.
$ ls -lR /usr/libexec/SmartCardServices/drivers
total 0
drwxr-xr-x 3 root wheel 102 23 aoû 2015 ifd-ccid.bundle
/usr/libexec/SmartCardServices/drivers/ifd-ccid.bundle:
total 0
drwxr-xr-x 5 root wheel 170 5 oct 2015 Contents
/usr/libexec/SmartCardServices/drivers/ifd-ccid.bundle/Contents:
total 56
-rw-r--r-- 1 root wheel 27616 5 oct 2015 Info.plist
drwxr-xr-x 4 root wheel 136 2 oct 2015 MacOS
-rw-r--r-- 1 root wheel 471 23 aoû 2015 version.plist
/usr/libexec/SmartCardServices/drivers/ifd-ccid.bundle/Contents/MacOS:
total 176
lrwxr-xr-x 1 root wheel 20 2 oct 2015 libccid.dylib -> libccid.dylib.1.4.14
-rwxr-xr-x 1 root wheel 165888 17 sep 2015 libccid.dylib.1.4.14
$ ls -lR /usr/libexec/SmartCardServices/drivers total 0 drwxr-xr-x 3 root wheel 102 Aug 23 2015 ifd-ccid.bundle /usr/libexec/SmartCardServices/drivers/ifd-ccid.bundle: total 0 drwxr-xr-x 5 root wheel 170 Jan 28 10:05 Contents /usr/libexec/SmartCardServices/drivers/ifd-ccid.bundle/Contents: total 24 -rw-r--r-- 1 root wheel 33873 Sep 23 2015 Info.plist drwxr-xr-x 5 root wheel 170 Jan 28 10:05 MacOS -rw-r--r-- 1 root wheel 469 Sep 23 2015 version.plist /usr/libexec/SmartCardServices/drivers/ifd-ccid.bundle/Contents/MacOS: total 344 lrwxr-xr-x 1 root wheel 20 Dec 9 15:06 libccid.dylib -> libccid.dylib.1.4.14 -rwxr-xr-x 1 root wheel 165888 Oct 18 2015 libccid.dylib.1.4.14 -rwxr-xr-x 1 root wheel 166096 Jan 14 03:06 libccid.dylib.1.4.20
$ pwd /Volumes/ElCapitan/usr/libexec/SmartCardServices/drivers $ ls -lR ifd-ccid.bundle/ total 0 drwxr-xr-x 5 root wheel 170 Mar 22 13:23 Contents ifd-ccid.bundle//Contents: total 24 -rw-r--r-- 1 root wheel 36860 Dec 21 06:05 Info.plist drwxr-xr-x 5 root wheel 170 Mar 22 13:23 MacOS -rw-r--r-- 1 root wheel 470 Dec 21 06:05 version.plist ifd-ccid.bundle//Contents/MacOS: total 344 lrwxr-xr-x 1 root wheel 20 Sep 16 2015 libccid.dylib -> libccid.dylib.1.4.14 -rwxr-xr-x 1 root wheel 165888 Sep 3 2015 libccid.dylib.1.4.14 -rwxr-xr-x 1 root wheel 166096 Mar 12 09:30 libccid.dylib.1.4.21
<key>CFBundleExecutable</key> <string>libccid.dylib</string>
/usr/libexec/SmartCardServices/drivers/ifd-ccid.bundle/Contents/MacOS: lrwxr-xr-x 1 root wheel 20 3 déc 08:37 libccid.dylib -> libccid.dylib.1.4.20 -rwxr-xr-x 1 root wheel 166096 12 mar 09:30 libccid.dylib.1.4.21
com.apple.ifdreader[219]: Failed to load IFD bundle executable: 'file:///usr/libexec/SmartCardServices/drivers/ifd-ccid.bundle/' with error: Error Domain=NSCocoaErrorDomain Code=4 "The bundle “CCIDCLASSDRIVER” couldn’t be loaded because its executable couldn’t be located." UserInfo={NSLocalizedFailureReason=The bundle’s executable couldn’t be located., NSLocalizedRecoverySuggestion=Try reinstalling the bundle., NSBundlePath=/usr/libexec/SmartCardServices/drivers/ifd-ccid.bundle, NSLocalizedDescription=The bundle “CCIDCLASSDRIVER” couldn’t be loaded because its executable couldn’t be located.}
cd /usr/libexec/SmartCardServices/drivers/ifd-ccid.bundle/Contents/MacOS ln -sf libccid.dylib.1.4.21 libccid.dylib
"Engineering has determined that your bug report (25873806) is a duplicate of another issue (25416818) and will be closed."