certificateprivate-keycertreq

Private key from Certificate generated with certreq is not exportable


I have created a Certificate with an inf-file and certreq with the following settings:

   $InfFile = @"
    [NewRequest]`r
    FriendlyName = $FQDN
    Subject = "CN=$FQDN,OU=$OrganizationalUnit,O=$Organisation,L=$Locality,S=$State,C=$CountryName,E=$Email"`r
    KeySpec = 1
    KeyLength = 2048
    Exportable = TRUE`r
    RequestType = PKCS10`r

    [Extensions]
    2.5.29.17 = "{text}"
    _continue_ = "DNS=$FQDN&"
    _continue_ = "DNS=$SERVERNAME"
"@

If I run this in a Script, the certificate will be created. But I'm unable to export the private key even though I set the value of "Exportable" to true. It seems no key is associated with the certificate as shown in this picture:

Certificate without key

Here a Certificate with associated Key for reference:

Certificate with Key

I'm not quite sure what I am doing wrong, any ideas?

Cheers Buffalosoldier


Solution

  • Just found the answer to my own question. I had to add the following to the inf file: MachineKeySet = TRUE