Chris Evans
Chris Evans

Reputation: 236

How to determine the type of smart card reader (contact vs contactless)

I have a PC/SC abstraction layer I am working with (home brewed) and am curious how to determine the type of reader I may be interacting with. I am currently using a method that involved name regex matching of strings based on the name of the reader. This is fine, accept that no standard is in place on how to name a reader causing this method to be susceptible to error. Anyone have any concrete suggestions to try that may be based on some lower level communication with the reader?

Hope to hear some ideas!

Upvotes: 2

Views: 2607

Answers (3)

H.A.H.
H.A.H.

Reputation: 3897

Im sorry, I know its not answer to your question but hear this. My solution is exacty the same as yours. From the list of names, I check them if they contain specific parts, then I make conclusion if this is known type or unknown reader.

After that, If the reader is known type, I know what protocol to use for the reader, not just that it is the contactless reader. And if you have two, you know which is which.

It works great for me (for several months now), and if you dont HAVE TO switch it for a reason I didnt understand, you can leave it as is.

Upvotes: 1

AndrewDover
AndrewDover

Reputation: 11

You can get the ISO 14443 contactless UID only on contactless readers.

PC/SC's "Part 3. Requirements for PC-Connected Interface Devices", page 26, in table Table 3-8a: defines a GET DATA Command APDU that returns the UID of a contactless device.

FF CA 00 00 00 

So if the command succeeds, you know it is a contactless reader. If the command fails, either your reader does not support the command or it is a contact reader.

I know these readers support the command:

  • OMNIKEY CardMan 5x21-CL 0
  • Identive SDI011G Contactless Reader 0
  • Identive SDI010 Contactless Reader 0
  • SCM Microsystems Inc. SDI011G Contactless Reader 0
  • ACS ACR1252 1S CL Reader PICC 0

Look in pcsc3_v2.01.09.pdf in Pcsc1-10 V2 01 14.zip (from PC/SC Workgroup Specification Files).

Upvotes: 1

S.K.
S.K.

Reputation: 31

I don't know exactly what you mean by the type of the reader but to know all the readers attached to the system you can use the SCardListReaders(...) API.

As defined on the Microsoft MSDN page:

LONG WINAPI SCardListReaders(
  __in      SCARDCONTEXT hContext,
  __in_opt  LPCTSTR mszGroups,
  __out     LPTSTR mszReaders,
  __inout   LPDWORD pcchReaders
);

This returns a list of all the readers in the string format for e.g. a SCM reader will be returned something like "SCM Microsystems Inc. SCL011 Contactless Reader 0".

Hope this helps !!

Upvotes: 1

Related Questions