File: SCARDCONTROL.md

package info (click to toggle)
ccid 1.7.1-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 4,144 kB
  • sloc: ansic: 11,278; sh: 254; lex: 244; makefile: 151; perl: 91; python: 77
file content (73 lines) | stat: -rw-r--r-- 2,287 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# List of SCardControl() commands supported by the CCID driver

PC/SC provides the `SCardControl()` function to send commands to the
driver and/or reader. Here is the list of supported commands by this
CCID driver.


## PC/SC function prototype

See also [SCardControl()](https://pcsclite.apdu.fr/api/group__API.html#gac3454d4657110fd7f753b2d3d8f4e32f) in the pcsclite API documentation.

```C
LONG SCardControl(
    SCARDHANDLE hCard,
    DWORD       dwControlCode,
    LPCVOID     pbSendBuffer,
    DWORD       cbSendLength,
    LPVOID      pbRecvBuffer,
    DWORD       cbRecvLength,
    LPDWORD     lpBytesReturned
)
```

Parameters:

* [in]     `hCard`            Connection made from `SCardConnect()`.
* [in]     `dwControlCode`    Control code for the operation.
* [in]     `pbSendBuffer`     Command to send to the reader.
* [in]     `cbSendLength`     Length of the command.
* [out]    `pbRecvBuffer`     Response from the reader.
* [in]     `cbRecvLength`     Length of the response buffer.
* [out]    `lpBytesReturned`  Length of the response.

If the `dwControlCode` is not supported the application receives the error
`SCARD_E_UNSUPPORTED_FEATURE` or `SCARD_E_NOT_TRANSACTED` as a general error
code.


## supported ControlCode values

* `IOCTL_SMARTCARD_VENDOR_IFD_EXCHANGE`

    defined as `SCARD_CTL_CODE(1)`

    The `pbSendBuffer[]` buffer is sent as a `PC_to_RDR_Escape` CCID command

    For security possible problems this command in possible in the
    following cases only:
    - the reader is a Gemalto (ex Gemplus) reader and the command is:
      - get firmware version
      - switch interface on a ProxDU
    - the `ifdDriverOptions` (in the `Info.plist` file) has the bit
      `DRIVER_OPTION_CCID_EXCHANGE_AUTHORIZED` set

* `CM_IOCTL_GET_FEATURE_REQUEST`

    defined as `SCARD_CTL_CODE(3400)`

    Implements the PC/SC v2.02.08 Part 10 IOCTL mechanism

* `IOCTL_FEATURE_VERIFY_PIN_DIRECT`
* `IOCTL_FEATURE_MODIFY_PIN_DIRECT`
* `IOCTL_FEATURE_IFD_PIN_PROPERTIES`
* `IOCTL_FEATURE_MCT_READERDIRECT`
* `IOCTL_FEATURE_GET_TLV_PROPERTIES`

    See PC/SC v2.02.08 Part 10

* `SCARD_CTL_CODE(3601)`

	Returns the USB path of the reader following the format
	`<bus>-<port[.port[.port]]>:<config>.<interface>`
	(e.g., `1-1.3.2:1.0`) as in `/sys/bus/usb/devices/`.