2

Folks, I'm working on a certificate authentication app that will authenticate user based on CAC inserted. How do I know when the CAC is inserted / removed? I'll be "catching" that event in C++ or Java. Thanks.

Scott Stafford
  • 43,764
  • 28
  • 129
  • 177
user375525
  • 35
  • 5
  • For using Smartcard/USB Tokens in modern browsers, please refer https://stackoverflow.com/a/63173083/9659885 For CAC PKI Web Authentication, demo is available at https://web.signer.digital/home Signer.Digital Browser Extension is free and available for all OS. – Bharat Vasant Sep 28 '21 at 10:14

2 Answers2

3

You have two options:

  1. If you go for "low level" (which you apparently want to do) is to use PC/SC level (pcsc-lite) and the SCardGetStatusChange function (or the equivalent in Java, what is javax.smartcardio.CardTerminal.waitForCardPresent())
  2. If you're working with higher level abstractions and go for PKCS#11 (and if your PKCS#11 provider implements it correctly), C_WaitForSlotEvent can be used.
Martin Paljak
  • 4,119
  • 18
  • 20
0

You might see if it is reported through udev.

caf
  • 233,326
  • 40
  • 323
  • 462
  • And if not, it probably could be. – Tim Post Jun 25 '10 at 15:25
  • As a smart card will not show up as a device, why should it be reported via udev? Smart card readers (or USB tokens) that actually connect to a USB port are reported via udev but not smart cards (AFAIK) – Martin Paljak Jun 27 '10 at 13:54