Where does a Windows Certification Authority store its root private key

ad-certificate-servicescertificate-authoritywindows-server-2012-r2

I have a Windows Server 2012 R2 Enterprise Root Certification Authority on a Hyper-V virtual machine which, due to currently unkown reasons, doesn't boot anymore.

I don't know if the VM will ever come back online, but what I know is, I have its virtual disk and it seems to be undamaged; I can mount it on another system and access all of its contents.

I'd like to rebuild the CA on a new virtual machine, and I'm accustomed to this process, having performed lots of CA migrations before; I know where to find the Certification Authority database (C:\Windows\system32\certlog), and how to copy it over to a newly-built CA.

What I don't know is, where is the CA's root certificate stored? I'll need its private key in order to rebuild the CA, but I don't know where to find it on the failed CA's virtual disk.

Best Answer

You can't recover CA key from offline machine. There are two reasons:

  1. Reference to a key is somewhat complicated, therefore it is hard to find the actual private key file name. In your case, private key file is located in: %ALLUSERSPROFILE%\Application Data\Microsoft\Crypto\Keys
  2. even if you success on file name identification, you won't be able to just copy file to another computer and restore the key pair, because private key locally is protected by a DPAPI and you will fail to decrypt the encrypted key on another computer.

If you could run computer in at least Safe Mode (or save mode with command prompt), you could easily identify file name and attempt to export the key to a PFX).