I am fairly new to certificates in general and have setup my own standalone CA for testing purposes. I have noticed some interesting behavior of private keys which I'm trying to find some documentation on.
In Certificate Authority Console (certsvr / Windows Server)
If I create a certificate request marking my certificate as exportable, submit it, approve it and then export it in the certificate authority (export as binary), I am able to export it with the private key. However, I can only do it once. The next time I try it again, the private key is no longer there. Is this correct? Is the private key always included only on the first export?
When importing a certificate with a private key, whether using certutil or the mmc snap in, sometimes I notice that the file I exported from is no longer valid. So now to make sure I don't lose the key in the file, I always create a copy first.
I seem to keep losing the private key. I'ved often saved files (.pfx) and import them, delete the certificate in my store only to find out that the same file doesn't have a private key anymore when I tried to import it again. This is okay for now since I'm just using this for testing but if any one has detailed understanding of how this work then that would be great.