|
Packit |
9f0df5 |
List of SCardGetAttrib() commands supported by the CCID driver
|
|
Packit |
9f0df5 |
==============================================================
|
|
Packit |
9f0df5 |
|
|
Packit |
9f0df5 |
PC/SC provides the SCardGetAttrib() function to request some attributes from
|
|
Packit |
9f0df5 |
the driver.
|
|
Packit |
9f0df5 |
|
|
Packit |
9f0df5 |
|
|
Packit |
9f0df5 |
PC/SC function prototype
|
|
Packit |
9f0df5 |
"""""""""""""""""""""""""
|
|
Packit |
9f0df5 |
|
|
Packit |
9f0df5 |
LONG SCardGetAttrib(SCARDHANDLE hCard,
|
|
Packit |
9f0df5 |
DWORD dwAttrId,
|
|
Packit |
9f0df5 |
LPBYTE pbAttr,
|
|
Packit |
9f0df5 |
LPDWORD pcbAttrLen);
|
|
Packit |
9f0df5 |
|
|
Packit |
9f0df5 |
Parameters:
|
|
Packit |
9f0df5 |
|
|
Packit |
9f0df5 |
hCard IN Connection made from SCardConnect
|
|
Packit |
9f0df5 |
dwAttrId IN Identifier for the attribute to get
|
|
Packit |
9f0df5 |
pbAttr OUT Pointer to a buffer that receives the attribute
|
|
Packit |
9f0df5 |
pcbAttrLen IN/OUT Length of the pbAttr buffer in bytes
|
|
Packit |
9f0df5 |
|
|
Packit |
9f0df5 |
If the attribute is not supported the applications receive the error
|
|
Packit |
9f0df5 |
SCARD_E_UNSUPPORTED_FEATURE (or SCARD_E_NOT_TRANSACTED for pcsc-lite
|
|
Packit |
9f0df5 |
version < 1.3.3)
|
|
Packit |
9f0df5 |
|
|
Packit |
9f0df5 |
|
|
Packit |
9f0df5 |
supported attributes
|
|
Packit |
9f0df5 |
""""""""""""""""""""
|
|
Packit |
9f0df5 |
|
|
Packit |
9f0df5 |
SCARD_ATTR_ATR_STRING
|
|
Packit |
9f0df5 |
ATR of the card
|
|
Packit |
9f0df5 |
|
|
Packit |
9f0df5 |
SCARD_ATTR_ICC_INTERFACE_STATUS
|
|
Packit |
9f0df5 |
Single byte. Zero if smart card electrical contact is not active;
|
|
Packit |
9f0df5 |
nonzero if contact is active.
|
|
Packit |
9f0df5 |
|
|
Packit |
9f0df5 |
SCARD_ATTR_ICC_PRESENCE
|
|
Packit |
9f0df5 |
Single byte indicating smart card presence:
|
|
Packit |
9f0df5 |
0 = not present
|
|
Packit |
9f0df5 |
1 = card present but not swallowed (applies only if reader supports
|
|
Packit |
9f0df5 |
smart card swallowing)
|
|
Packit |
9f0df5 |
2 = card present (and swallowed if reader supports smart card swallowing)
|
|
Packit |
9f0df5 |
4 = card confiscated.
|
|
Packit |
9f0df5 |
|
|
Packit |
9f0df5 |
SCARD_ATTR_VENDOR_IFD_VERSION
|
|
Packit |
9f0df5 |
Vendor-supplied interface device version
|
|
Packit |
9f0df5 |
DWORD in the form 0xMMmmbbbb where
|
|
Packit |
9f0df5 |
MM = major version,
|
|
Packit |
9f0df5 |
mm = minor version,
|
|
Packit |
9f0df5 |
and bbbb = build number
|
|
Packit |
9f0df5 |
It is the bcdDevice USB field.
|
|
Packit |
9f0df5 |
|
|
Packit |
9f0df5 |
SCARD_ATTR_VENDOR_NAME
|
|
Packit |
9f0df5 |
name of the IFD (reader) vendor. It is the iManufacturer USB field
|
|
Packit |
9f0df5 |
(if any).
|
|
Packit |
9f0df5 |
|
|
Packit |
9f0df5 |
SCARD_ATTR_MAXINPUT
|
|
Packit |
9f0df5 |
maximum size of an APDU supported by the reader.
|
|
Packit |
9f0df5 |
format is unsigned 32-bit unsing the byte order of the platform.
|
|
Packit |
9f0df5 |
Correct readers should support up to 261 bytes (CLA + INS + P1 + P2 +
|
|
Packit |
9f0df5 |
Lc + 255 bytes of data) but some readers support less (253 bytes only
|
|
Packit |
9f0df5 |
for example). It is a problem for T=1 cards when the reader works in
|
|
Packit |
9f0df5 |
APDU mode instead of TPDU and for T=0 cards.
|
|
Packit |
9f0df5 |
|
|
Packit |
9f0df5 |
SCARD_ATTR_VENDOR_IFD_SERIAL_NO
|
|
Packit |
9f0df5 |
reader serial number (if available).
|
|
Packit |
9f0df5 |
|
|
Packit |
9f0df5 |
|
|
Packit |
9f0df5 |
Sample code
|
|
Packit |
9f0df5 |
===========
|
|
Packit |
9f0df5 |
|
|
Packit |
9f0df5 |
#include <reader.h>
|
|
Packit |
9f0df5 |
|
|
Packit |
9f0df5 |
{
|
|
Packit |
9f0df5 |
[...]
|
|
Packit |
9f0df5 |
|
|
Packit |
9f0df5 |
unsigned char pbAtr[MAX_ATR_SIZE];
|
|
Packit |
9f0df5 |
DWORD dwAtrLen;
|
|
Packit |
9f0df5 |
|
|
Packit |
9f0df5 |
/* use a NULL buffer to just get the needed length */
|
|
Packit |
9f0df5 |
rv = SCardGetAttrib(hCard, SCARD_ATTR_ATR_STRING, NULL, &dwAtrLen);
|
|
Packit |
9f0df5 |
if (rv == SCARD_S_SUCCESS)
|
|
Packit |
9f0df5 |
printf("ATR length: %ld\n", dwAtrLen);
|
|
Packit |
9f0df5 |
|
|
Packit |
9f0df5 |
dwAtrLen = sizeof(pbAtr);
|
|
Packit |
9f0df5 |
rv = SCardGetAttrib(hCard, SCARD_ATTR_ATR_STRING, pbAtr, &dwAtrLen);
|
|
Packit |
9f0df5 |
if (rv == SCARD_S_SUCCESS)
|
|
Packit |
9f0df5 |
{
|
|
Packit |
9f0df5 |
for (i = 0; i < dwAtrLen; i++)
|
|
Packit |
9f0df5 |
printf("%02X ", pbAtr[i]);
|
|
Packit |
9f0df5 |
printf("\n");
|
|
Packit |
9f0df5 |
}
|
|
Packit |
9f0df5 |
}
|
|
Packit |
9f0df5 |
|