smartcardapduwinscardifd

Reader MaxIFSD attribute from smartcard reader


I am trying to find a method to read IFD (Interface Device - Serial Number) attributes from a reader when a card is NOT present. The SCard API seems to have this requirement that all attributes can only be read through a card handle. While this seems obvious for card attributes, it seems to be a bad requirement to read reader attributes.

One route I am looking at is sending a TLV command to the reader driver directly; which should work, but the issue with that is I need to figure out the name the driver has exposed for its FDO.

Even many of the smartcard utilities I have downloaded and tested also have the requirement that a card be present. However one utility (PCSCDiag.exe) is able to get the one value that I am after even when the card is not present.


Solution

  • You can get a handle by passing SCARD_SHARE_DIRECT to SCardConnect (beware of possible portability issues!). Have a look at src/libopensc/reader-pcsc.c in OpenSC for reading reader parameters (if available, only standard ones are used) from reader (drivers).