Home > Software engineering >  How can I access the certificate(.pfx) attached to https post request from postman, inside a control
How can I access the certificate(.pfx) attached to https post request from postman, inside a control

Time:09-30

I am attaching a certificate to a post request from postman(setting-> add certificate section) and hitting a contoller present in dotnet core web api3. postman adding certificate image

Now I want to access the certificate and its thumbprint from a controller that I am hitting. How can I acces the certificate and thumbprint from inside the contoller?

 [HttpPost]
 public void getcertificate()
  {
    // I want to access the certificate(.pfx file) and its thumbprint here.
  }

How Can I access the certificate and retrieve thumbprint inside this controller.

CodePudding user response:

You can access the thumbprint inside controller like this

HttpContext.Connection.ClientCertificate.Thumbprint

Hope it helps.

  • Related