We developed a .NET C # web application for DoD that uses CAC (Common Access Card) as the only authentication method. We have reliable SSL on the servers, the application works in several places, and everything works as it should - for the most part.
Problem number 1
The main problem is that on some of our internal development servers, when you click on "login" with a valid CAC in the card reader, only one certificate is displayed, not the CAC. It is used to authenticate my work laptop using a network (the attributes "Client Authentication" and "Login for a smart card" are checked in the "Certificates" snap-in).
We have another server on another network where client certificate authentication works well - it shows certificates from the CAC and does not display the certificate described above. I tried to compare everything that I can imagine in Windows Server 2008 R2 on these two servers, side by side, to find out if I can find something that could be different, but both of them are the default settings of Windows Server 2008 by default is R2.
The following code is used to read the client certificate:
if (Request.ClientCertificate.IsPresent) { HttpClientCertificate Cert = HttpContext.Current.Request.ClientCertificate; //use cert info to check db and create session }
This file is located in the directory where IIS> SSL> "Require SSL" and "Require Client Certificates" are checked.
I do not know if this is a server configuration problem or a coding problem, but I have been working on this for several months and cannot find an answer about why the application cannot receive CAC certificates only when it is hosted on some servers.
Problem number 2
If I access the application on the server where the CAC is read correctly, it extracts copies of all certificates from all CACs used to access the application on this computer, and not just from the certificates from the CAC physically to the card reader.
AKO [https://akologin.us.army.mil/] at least filters out email certificates; however, this site is not hosted in a Windows window.
Conclusion
It seems to me that there should be a better, more detailed mechanism for accessing and filtering client certificates from a smart card reader, except for the Request.ClientCertificate collection, and two flags in IIS.