title: How do I export a HCRYPTKEY or PRIVATEKEYBLOB to a PFX file
body: <p>I have a previously generated RSA private signing key, which is stored as a <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa379931%28v=vs.85%29.aspx" rel="nofollow">PRIVATEKEYBLOB</a>. I am trying to move this into a new certificate for better management of the key. How do I take this blob and turn it into a .pfx certificate?</p>
  
  <p>I have a HCRYPTPROV (uses MS_ENHANCED_PROV and PROV_RSA_FULL).
  I can get a HCRYPTKEY from CryptImportKey.</p>
  
  <p>PFXExportCertStoreEx seems to be the function to export it to a PFX blob (which I'm assuming I would then write to a file), but I don't understand how to get the key into it.</p>