title: How to set read permission on the private key file of X.509 certificate from .NET
body: <p>Here is the code to add a pfx to the Cert store.</p>
  
  <pre><code>X509Store store = new X509Store( StoreName.My, StoreLocation.LocalMachine );
  store.Open( OpenFlags.ReadWrite );
  X509Certificate2 cert = new X509Certificate2( "test.pfx", "password" );
  store.Add( cert );
  store.Close();
  </code></pre>
  
  <p>However, I couldn't find a way to set permission for NetworkService to access the private key. </p>
  
  <p>Can anyone shed some light? Thanks in advance.</p>