Setup https server with a self SSL certificate for testing.

Copy part of content from below url: http://blog.sina.com.cn/s/blog_7be3b4570100sqi0.html:

There is a solution to the problem.  We need togo old-school.  The IIS6 Resource Kit contained atool called SelfSSL.  We need that exe and willuse it to create our self-signed cert from the commandline.  (BTW, this information was sourced from ablog by Hans Olav.  You can find his post here.

  1. Delete the certificate from the previous section of thispost.
  2. Make sure you have SelfSSL.exe.  If not, youcan download the exe here.
  3. Open a command prompt (run as administrator)
  4. Navigate to the directory containing SelfSSL.exe
  5. In IIS, click on the Sites node to get the siteid.  We will pass it as an argument toSelfSSL
     
  6. As per Olav’s blog, run SelfSSL /N:CN=<your website address (no http://)> /V:<howmany days the certificate should be valid>/S:<site ID from above>[/P:<port, if not 443>]
    For me it was: SelfSSL /N:CN=www.testssl.com /V:1000 /S:2
     
  7. Take another look:

    We seem to be good so far.

  8. Test it again

    It appears we still have a problem. Now IE is telling me thatthe certificate was not issued by a trusted authority – which istrue. But in our test environment, we are trusted. So, let’s dealwith this…

 

Adding the Certificate to Trusted Root CertificateAuthorities

We could solve this problem by adding the certificate to theTrusted Root Certification Authorities in IE, but if we areexposing services, we will need to add it to the LocalComputer.  Here is what we need to do

  1. Export the certificate

  2. Open Certificate Manager
    Start | Run | mmc.exe certmgr.msc

  3. Add the cert to "Local Computer" Trusted Root CertificationAuthorities

    Right-Click on "Certificates" under "Trusted Root CertificationAuthorities" | All Tasks | Import

    Click Next on the splash screen and enter the path to the exportyou did in the last step (you need to change the file extensionchoice in the dialog to pfx)

    Enter the password you created when exporting

    On the next screen, click Browse so we can select theappropriate store (Local Machine)

    Make sure you check the “Show Physical Stores” checkbox andchoose “Local Computer” under “Trusted Root CertificationAuthorities”

    On the next screen click finish. That is it!

 

Problem Solved


你可能感兴趣的:(Setup https server with a self SSL certificate for testing.)