创建自签名CA证书并安装在IIS中

本文关键字:安装 IIS 证书 CA 创建 | 更新日期: 2023-09-27 18:21:41

我用用户名/密码创建了WCF服务&证书身份验证。它在视觉工作室运行良好。

现在,我想在IIS(开发服务器)上托管WCF服务服务器:不带Hyper-V的Windows Server Standard(Service pack 2)IIS:7

有人能告诉我在服务器上创建自签名证书并将其分配给WCF服务的IIS(链信任证书)的方法吗。以及如何为客户端生成密钥证书以使用服务。

谢谢

创建自签名CA证书并安装在IIS中

如果这个过程很长,请耐心等待,但这个过程帮助我在开发过程中创建了自签名CA。

如何创建自签名证书的步骤:

假设:

  • Visual Studio已安装(2012/2013/2015)。

  • 你已经掌握了数字证书的基本知识(x.509)。

步骤:

  • 打开Visual Studio工具,然后选择的"开发人员命令提示符"VS2013/VS12作为管理员。并导航或cd到位置保存证书的位置。

  • 我们需要创建第一个根颁发机构作为我们的CA进行签名证明书为了创建根颁发机构证书,我们使用来自visualstudio的makecert.exe工具。有关更多详细信息关于makecert.exe,请参阅此处。

    Command: makecert –n “CN=DevRootCA” –r –sv DevRootCA.pvk DevRootCA.cer        
    
  • 说明:上面的命令将生成一个根权限用于签署证书的证书。使用我们的根颁发机构证书创建自签名证书来自步骤2。

    Command: makecert –pe –n “CN= localhost” –ss my –sky exchange –sk DevCert –iv DevRootCA.pvk –ic DevRootCA.cer –sr localmachine DevCert.cer
    Explanation: The command above will create and store certificate named “DevCert.cer” and it will be stored in Local Computer. To view certificates stored in your local computer Use Microsoft Management Console (mmc.exe). Please refer here    
    
  • 服务器和客户端能够信任每个名为"DevCert.cer"您需要在中安装根颁发机构证书客户端和服务器。

    Open Microsoft Management Console and follow here.
    Navigate to Certificate (Local Computer)
    Trusted Root Certification Authority
    Certificates
    At right side of panel right click at empty space All Task
    Import certificate then locate your Root Authority certificate.    
    
  • 使用私钥导出名为"DevCert.cer"的自签名证书为您的客户。

    Use MMC again for this step and navigate to
    Certificate (Local Computer)
    Trusted Root Certification Authority
    Certificates
    At the right side of panel right click the certificate that you want to export
    All tasks
    Export (Press Next)
    Choose option Yes
    Export the private key
    Leave default option (Press Next)
    Enter password (Press Next). Note : The password must much to the previouse password you enter upon creation.
    Browse where you want to save
    Next and Finish    
    
  • 使用导出的证书并安装到您的客户端计算机上。

如何在IIS中安装自签名证书:

假设:

  • 您已经在客户端计算机或服务器中安装了证书
  • 如何使用MMC安装自签名证书

步骤:

  • 打开IIS管理器,然后单击与您的计算机对应的本地主机就在起始页之后。

  • 单击默认网站。

  • 在"操作窗格"的右侧,单击"绑定"。

  • 单击添加并选择类型:https和确定按钮。(如果https已经存在存在只需更改证书)

  • 并选择与您的证书相对应的SSL证书。然后单击"确定"并关闭。

  • 验证您的网站是否已在使用您设置的证书。转到您的浏览并导航到您的网站,看看它是否会提示您关于证书,或者网站的URL旁边是否有挂锁。单击挂锁,看看它是否是您的证书。

重要信息:此程序仅适用于开发周期,不适用于生产。对于生产,您需要从证书颁发机构获取SSL证书。