Warning : This is not the exact answer for your question, but i hope it will give you some help towards what you want to acheive
Based on my experience, Windows crypto APIs are designed to use the private key within the certificate store rather than export the key outside, unless you are using CryptoAPI standard functions like PFXExportCertStoreEx ().
CryptExportKey function gives the private/public key pair in a key blob structure which you have to convert to the format you want. The closest thing i have ever seen this being being done is in
Openssl engine for Windows, filename : e_capi.c
refer to the function
**capi_load_privkey() and subfunction capi_get_pkey()**
Here conversion of the Key blob to OpenSSL compatible structure is done. Hope this helps