how can i export the private key as PKCS#7 ?



CryptExportKey export the privatekey,but it seemed the format is pkcs11,


i have tried CryptExportPKCS8,but but what's private key OID for my
certificate request?





//here are my source code
void exportPrivateKey(HCRYPTPROV &hCryptProv,DWORD &dwKeySpec,PCCERT_CONTEXT
&pSignerCertContext)
{
HCRYPTKEY phUserKey;
BYTE *pbKeyBlob;
DWORD dwBlobLen;

//CryptGetUserKey(hCryptProv,dwKeySpec,&phUserKey);
if(CryptExportPKCS8(
hCryptProv,
dwKeySpec,
"wh-ok",
0,
NULL,
NULL,
&dwBlobLen))
{
printf("Size of the BLOB for the public key determined. \n");
}
else
{
MyHandleError("Error computing BLOB length.");
}
//--------------------------------------------------------------------
// Allocate memory for the pbKeyBlob.

if(pbKeyBlob = (BYTE*)malloc(dwBlobLen))
{
printf("Memory has been allocated for the BLOB. \n");
}
else
{
MyHandleError("Out of memory. \n");
}
//--------------------------------------------------------------------
// Do the actual exporting into the key BLOB.

if(CryptExportPKCS8(
hCryptProv,
dwKeySpec,
"wh-ok",
0x8000,
NULL,
pbKeyBlob,
&dwBlobLen))
{
printf("Contents have been written to the BLOB. \n");
}
else
{
MyHandleError("Error during CryptExportKey.");
}

//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////


//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
FILE *fppp=fopen("pri.key","wb");
fwrite(pSignerCertContext->pbCertEncoded,1,pSignerCertContext->cbCertEncoded,fppp); fclose(fppp); ////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////}

.