I have been researching this topic for last 2 weeks and I have found so much information that I am overwhelmed. I am going to start from scratch. I am a newbie at this like never done anything with certificates before. I have created RESTful web api that catches requests from postman. In the request, I am sending a CERT (my-cert.cer). I would like to use API controller to capture the CERT from the request and validate what is on the server. Is it even possible to capture CERTs the way I am doing it? I have not found a good working example anywhere. Please help!
Here is my GET method
public class clientController : ApiController
{
public string Get(int id)
{
X509Certificate2 cert = Request.GetClientCertificate();
X509Certificate2 cert2 = RequestContext.ClientCertificate;
logger.addLine(LogLineType.Message, "CERT " + cert + "\n", "page", null);
logger.addLine(LogLineType.Message, "CERT 2" + cert2 + "\n", "page", null);
System.Console.WriteLine("cert : " + cert);
System.Console.WriteLine("cert2 : " + cert2);
GetClient getClient = new GetClient();
string response = getClient.RetrieveClientRequest(id).ToString();
return response; } }