forked from neutrinolabs/xrdp
-
Notifications
You must be signed in to change notification settings - Fork 4
licpcsc pcscd communication
jsorg71 edited this page Aug 29, 2022
·
12 revisions
libpcsc pcscd communication
1.0 Connection sequence
When an application is started that uses the lipcsc library, the connection sequence is started to connect the application to pcscd. Here is the connection sequence.
libpcsc | pcscd | |
---|---|---|
CMD_VERSION with header | >> | CMD_VERSION with header |
CMD_VERSION | << | CMD_VERSION |
1.1 Message Header The header is attached before all messages going from libpcsc to pcscd. The header includes.
type | description |
---|---|
UINT32 | Size - Message bytes |
UINT32 | Command - Message command see 1.3 |
1.2 Environment variables
The environment variable PCSCLITE_CSOCK_NAME is used to tell the pcsc library what unix domain socket to connect to.
example export PCSCLITE_CSOCK_NAME=/tmp/pcsc_test pcsc_scan
The will cause pcsc_scan to try to connect to /tmp/pcsc_test through the libpcsclite library.
1.3 Error codes
name | value | name | value |
---|---|---|---|
SCARD_S_SUCCESS | 0x00000000 | SCARD_F_INTERNAL_ERROR | 0x80100001 |
SCARD_E_CANCELLED | 0x80100002 | SCARD_E_INVALID_HANDLE | 0x80100003 |
SCARD_E_INVALID_PARAMETER | 0x80100004 | SCARD_E_INVALID_TARGET | 0x80100005 |
SCARD_E_NO_MEMORY | 0x80100006 | SCARD_F_WAITED_TOO_LONG | 0x80100007 |
SCARD_E_INSUFFICIENT_BUFFER | 0x80100008 | SCARD_E_UNKNOWN_READER | 0x80100009 |
SCARD_E_TIMEOUT | 0x8010000A | SCARD_E_SHARING_VIOLATION | 0x8010000B |
SCARD_E_NO_SMARTCARD | 0x8010000C | SCARD_E_UNKNOWN_CARD | 0x8010000D |
SCARD_E_CANT_DISPOSE | 0x8010000E | SCARD_E_PROTO_MISMATCH | 0x8010000F |
SCARD_E_NOT_READY | 0x80100010 | SCARD_E_INVALID_VALUE | 0x80100011 |
SCARD_E_SYSTEM_CANCELLED | 0x80100012 | SCARD_F_COMM_ERROR | 0x80100013 |
SCARD_F_UNKNOWN_ERROR | 0x80100014 | SCARD_E_INVALID_ATR | 0x80100015 |
1.4 List of commands
command | hex | source |
---|---|---|
SCARD_ESTABLISH_CONTEXT | 0x01 | SCardEstablishContext() |
SCARD_RELEASE_CONTEXT | 0x02 | SCardReleaseContext() |
SCARD_LIST_READERS | 0x03 | SCardListReaders() |
SCARD_CONNECT | 0x04 | SCardConnect() |
SCARD_RECONNECT | 0x05 | SCardReconnect() |
SCARD_DISCONNECT | 0x06 | SCardDisconnect() |
SCARD_BEGIN_TRANSACTION | 0x07 | SCardBeginTransaction() |
SCARD_END_TRANSACTION | 0x08 | SCardEndTransaction() |
SCARD_TRANSMIT | 0x09 | SCardTransmit() |
SCARD_CONTROL | 0x0A | SCardControl() |
SCARD_STATUS | 0x0B | SCardStatus() |
SCARD_GET_STATUS_CHANGE | 0x0C | Not used |
SCARD_CANCEL | 0x0D | SCardCancel() |
SCARD_CANCEL_TRANSACTION | 0x0E | Not used |
SCARD_GET_ATTRIB | 0x0F | SCardGetAttrib() |
SCARD_SET_ATTRIB | 0x10 | |
CMD_VERSION | 0x11 | |
CMD_GET_READERS_STATE | 0x12 | |
CMD_WAIT_READER_STATE_CHANGE | 0x13 | |
CMD_STOP_WAITING_READER_STATE_CHANGE | 0x14 |
1.4.17 CMD_VERSION
type | description |
---|---|
UINT32 | major - version number major |
UINT32 | minor - version number minor |
UINT32 | result - one of SCARD_S_SUCCESS, etc |