I am creating a certificate for use with SslStream, and I did it like this in XP:
makecert -r -pe -n "CN=aName" -ss my -sr localmachine -sky exchange
-sp "Microsoft RSA SChannel Cryptographic Provider" -sy 12 server.cer
If I understand this correctly, this creates a certificate in server.cer and creates a private key for it in my personal certificate store. Once I do this, I can create a certificate object as follows:
X509Certificate.CreateFromCertFile(certFile);
Then I use it with SSLStream and everything works fine.
Now that I have switched to Windows 7, the closing key seems to disappear every time the machine restarts. I run the command line as Administrator and run the same makecert command as shown above. This succeeds and the SSL connection is working correctly. If I restart the machine, the AuthenticateAsServer call will end with the error: "SSL server mode must use the certificate with the corresponding private key."
Why is the secret key locked? What do I need to do to get it stuck?
source
share