Makecert problem under Windows 7

Posted by TimK on Stack Overflow See other posts from Stack Overflow or by TimK
Published on 2010-04-01T19:20:13Z Indexed on 2010/04/01 19:23 UTC
Read the original article Hit count: 408

Filed under:
|
|

I'm creating a certificate to use with an SslStream, and I've been doing it this way under 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 have done this, I can create a certificate object like this:

X509Certificate.CreateFromCertFile(certFile);

I then use it with the SSLStream, and everything works fine.

Now that I have switched to Windows 7, the private key seems to be disappearing every time I restart the machine. I run a command prompt as Administrator, and execute the same makecert command shown above. This succeeds and the SSL connection works correctly. If I restart the machine, the call to AuthenticateAsServer fails with the exception "The server mode SSL must use a certificate with the associated private key."

Why is the private key disappearing? What do I need to do to make it stick around?

© Stack Overflow or respective owner

Related posts about makecert

  • Makecert.exe hangs

    as seen on Server Fault - Search for 'Server Fault'
    I was following the steps in Scott Hanselman's blog post describing how to create a certificate authority and code signing certificate for PowerShell scripts. Initially, I created the certificate authority and a personal certifcate and used it to sign a powershell script successfully. All went as… >>> More

  • Syntax error for makecert.exe tool

    as seen on Stack Overflow - Search for 'Stack Overflow'
    Did I missed anything during this? I am running a this command from command prompt in Windows 7 to create a certificate but it is showing a syntax error. Command I ran: makecert.exe "c:\1\Test.cer" -a sha1 -n "CN=AppGuid" -sr LocalMachine -ss My -sky signature -pe -len 2048 Output I got: Usage:… >>> More

  • Missing makecert.exe

    as seen on Stack Overflow - Search for 'Stack Overflow'
    For some reason I am missing makecert.exe on my system. I searched the whole hard drive and it's not there. In particular, it's not in C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin where I believe it's supposed to be. I haven't found any articles on this topic on the Internet. Any ideas what's… >>> More

  • Makecert problem under Windows 7

    as seen on Stack Overflow - Search for 'Stack Overflow'
    I'm creating a certificate to use with an SslStream, and I've been doing it this way under 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… >>> More

  • Using makecert for Development SSL

    as seen on Stack Overflow - Search for 'Stack Overflow'
    Here's my situation: I'm trying to create a SSL certificate that will be installed on all developer's machine's, along with two internal servers (everything is non-production). What do I need to do to create a certificate that can be installed in all of these places? Right now I've got something… >>> More

Related posts about windows-7