EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Detecting if card reader is plugged in computer

Posted: 09/27/2011 09:28:41
by ingbabic  (Standard support level)
Joined: 09/27/2011
Posts: 114

Is there a way to detect if smart card reader is plugged in computer (not smart card into smart card reader)? In TElPKCS11CertStorage class there is no such property. When I subscribe to event storage_OnSlotEvent I get notification when reader is plugged in or out of computer, but I don't know what property to read to know the state (whether it is in or out).

I tried with SlotCount property of Modul property of the TElPKCS11CertStorage object but it is allways 10, no matter if I have smart card reader device plugged in computer or not.

I am using aetpkss1.dll as PKCS#11 provider DLL.

Please help.
Posted: 09/27/2011 10:07:56
by Eugene Mayevski (Team)

Thank you for contacting us.

Unfortunately PKCS#11 standard doesn't provide uniform way for such checks. I guess each vendor has its own specific way to detect and expose devices. The only thing you can do is check the number of slots, but even in this case some vendors show fake slots.

Sincerely yours
Eugene Mayevski
Posted: 09/27/2011 10:38:24
by Ken Ivanov (Team)

A [sad] addition: *most* of the token drivers do not expose any difference between insertion of a token into a reader and insertion of a reader into a USB port. In other words, both these operations are reported to the user in the same way - insertion of a PKCS11 token into a PKCS11 slot. If your application needs to work with some particular token (and driver), it might make sense to dig around in order to find some "side ways" that will work with this very token, yet, this task is virtually non-resolvable if you need to built an universal solution compatible to all possible tokens.
Posted: 09/27/2011 12:22:10
by ingbabic  (Standard support level)
Joined: 09/27/2011
Posts: 114

Thank you very much for FAST response.

Somehow I have found my way out :). It seems that aetpkss1.dll allways shows 10 slots, but for slots which are not plugged, SlotDescription property starting with UNAVAILABLE. So I used this and it seems that it works for me.

At least with this PKCS provider it can be made like that.

Best regards



Topic viewed 828 times

Number of guests: 1, registered members: 0, in total hidden: 0


Back to top

As of July 15, 2016 EldoS business operates as a division of /n software, inc. For more information, please read the announcement.

Got it!