title: Verify signature with public key only (C#)
body: <p>I have two applications. One that signs a file and the other that verifies.</p>
  
  <p>The signing application does the following:</p>
  
  <pre><code>X509Certificate2 certificate = new X509Certificate2(PROJECT_DIR_PATH + "cert.pfx", "password");
  
  using (RSA rsa = certificate.GetRSAPrivateKey())
  {
      signature = rsa.SignData(exeContent, HashAlgorithmName.SHA1, RSASignaturePadding.Pkcs1);
  }
  </code></pre>
  
  <p>cert.pfx is a self-signed certificate, generated with Openssl.</p>
  
  <p>The verifying application:</p>
  
  <pre><code>X509Certificate2 certificate = new X509Certificate2(PROJECT_DIR_PATH + "cert.pfx", "password");
  
  using (RSA rsa = certificate.GetRSAPublicKey())
  {
      return rsa.VerifyData(exeContentWithoutSignature, signature, HashAlgorithmName.SHA1, RSASignaturePadding.Pkcs1);
  }
  </code></pre>
  
  <p>As I understand the .pfx file contains public and private key information, thus I should not make it available to anyone. As I know, only the public key is needed for the verification step. 
  How can I use rsa.VerifyData or other functions to verify the signature without exposing my pfx file?</p>