2

Could someone please tell me a way to just store the username from a DoD CAC card? I do not need to do any authentication, just have the name from a card stored as a variable. I don't think the machine reading the cards will have any network connection. I'm language/OS agnostic at this point.

Thank you.

dcclassics
  • 896
  • 1
  • 12
  • 38

1 Answers1

2

So I will answer for Windows and Java.

Enumerate the terminals, then if a card is present, (assuming only current CAC cards):

cc.transmit(new CommandAPDU(CMD_SELECT_APPLET_CAC_CACV2_PKI_IDENTITY_KEY));
cc.transmit(new CommandAPDU(CMD_SELECT_EF_CACV2_PKI_IDENTITY_KEY));
List<byte[]>[] res = TLVContainer.getTagAndValues(cc);
x509cert = X509CACHelper.fromBytes(res[0x71].get(0)[0],res[0x70].get(0));

You can look up the select applet and select EF commands in nist 6887, the RID, AID, OID can be found on docs at cac.mil.

Jason Pyeron
  • 2,388
  • 1
  • 22
  • 31