title: How to get public key from .pfx
body: <p>I have Mycert.pfx file, I could extract private key using below code but not sure how to extract public key from .pfx file.</p>
  
  <blockquote>
    <p>private static X509Certificate2 LoadPrivateKey()
     {
        return new X509Certificate2(@"d:\myCert.pfx", "Pass123$");
     }</p>
  </blockquote>
  
  <p>Is it possible to get public key from .pfx, if so could you please share sample code of it.</p>