title: Associate private key to certificate for PFXExportCertStoreEx
body: <p>I'm trying to export certificate to pfx file. Here's what I do (simplified):</p>
  
  <pre><code>h = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, NULL, CERT_STORE_CREATE_NEW_FLAG, NULL); 
  p = CertCreateCertificateContext(X509_ASN_ENCODING | PKCS_7_ASN_ENCODING,
                    CertBlob.pbData, CertBlob.cbData);
  CertSetCertificateContextProperty(p, CERT_KEY_PROV_HANDLE_PROP_ID, 0, &amp;hPrivKey);
  CertAddCertificateContextToStore(h, p, CERT_STORE_ADD_ALWAYS, NULL);
  PFXExportCertStoreEx(h, &amp;SomeBlob, L"", NULL, EXPORT_PRIVATE_KEYS);
  </code></pre>
  
  <p>PFX created, no private key exported. Anyone ever exported private key to pfx? What's the proper way to attach private key to certificate so that it could be exported?</p>