title: Get certificate KeyContainerName and other attributes
body: <p>I am trying to sign XML with a custom generated certificate which is acessible via this code</p>
  
  <pre><code>private void buttonSelectCertificate_Click(object sender, EventArgs e)
  {
     CertStoreLocation = (StoreLocation)cboStoreLocation.SelectedItem;
     CertStoreName = (StoreName)cboStoreName.SelectedItem;
     X509Store store = new X509Store(CertStoreName, CertStoreLocation);
              store.Open(OpenFlags.ReadOnly);
     X509Certificate2Collection scollection = X509Certificate2UI.SelectFromCollection(store.Certificates, "Certificate Select", "Select a certificate from the following list to get information on that certificate",  System.Security.Cryptography.X509Certificates.X509SelectionFlag.SingleSelection);
  }
  </code></pre>
  
  <p>What I cannot get how to use properly <code>X509Certificate2Collection scollection</code> 
  in order to fill out following  properties. </p>
  
  <p>Also I am not getting following idea:</p>
  
  <p>If certificate is stored here <code>My = 5</code>   then have I use 
  <code>CspProviderFlags.UseMachineKeyStore</code> ?     </p>
  
  <p>How can I get the <code>KeyContainerName</code> from <code>X509Certificate2Collection scollection</code>?</p>
  
  <p>And finally maybe I am completely wrong in the way to get certificate attributes I need in order to populate <code>CspParameters</code> class, any clue?</p>
  
  <p>Thank you for help!</p>
  
  <pre><code>// Get the key pair from the key store.
  CspParameters parms = new CspParameters(1);         // PROV_RSA_FULL
  parms.Flags = ??? CspProviderFlags.UseMachineKeyStore;  // Use Machine store
  parms.KeyContainerName = ???;               // 
  parms.KeyNumber = 2;                                // AT_SIGNATURE
  RSACryptoServiceProvider csp = new RSACryptoServiceProvider(parms);
  </code></pre>