ssl - 将自签名 ssl 证书绑定(bind)到端口失败

标签 ssl https certificate windows-10 netsh

我希望将自签名证书绑定(bind)到端口以开发我的自托管 wcf 应用程序,但我总是失败。

我完成的步骤:

  1. 创建根证书:

    • makecert.exe -a SHA256 -n "CN=DemoCA"-r -sv TempDemoCA.pvk TempDemoCA.cer
  2. 创建客户端证书:

    • makecert.exe -a SHA256 -sk Demo -iv TempDemoCA.pvk -n "CN=DemoTempCert"-ic TempDemoCA.cer DemoTemp.cer -sr currentuser -ss My -sky exchange<
  3. 使用 mmc.exe(以管理员身份)将根证书导入本地计算机证书

  4. 使用mmc.exe将客户端证书导入本地计算机证书

  5. 将私钥添加到客户端证书,因为它没有 key 图标:

    • certutil -repairstore 我的“MyKeyHash”
  6. 添加了一个防火墙条目:

    • netsh http add urlacl url=https://+:9003/user=domain\user listen=yes
  7. 尝试将证书绑定(bind)到端口(作为管理员):

    • netsh http add sslcert ipport=0.0.0.0:9003 certhash=MyCertHash appid={NewGuid} clientcertnegotiation=enable

但是第 7 步失败,出现错误 1312。

SSL Certificate add failed, Error 1312

A specified logon session does not exist. It may already have been terminated.

我通过谷歌搜索发现的所有内容都没有解决我的问题,例如: - 通过 mmc 而不是 certmgr.msc 导入 - 创建一个新证书 - 知识库修补程序

有趣的事实:将现有的“本地主机”客户端证书绑定(bind)到端口工作正常。

我做错了什么? 提前致谢。

最佳答案

解决方案是通用名称必须与服务使用的域相同。在我的例子中,localhost 成功了。

关于ssl - 将自签名 ssl 证书绑定(bind)到端口失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43849860/

相关文章:

ssl - 带有apache连接的gitlab被拒绝

node.js - Webpack DevServer -> 代理 HTTPS 资源 -> UNABLE_TO_VERIFY_LEAF_SIGNATURE

powershell - 签署 powershell 脚本?

Azure VPN 错误找不到可与此可扩展身份验证协议(protocol)一起使用的证书。 (错误798)

java - 苹果推送APNS连接

amazon-web-services - 隐私错误 NET::ERR_CERT_AUTHORITY_INVALID 带有 ELB 的 Amazon EC2 单实例

java - 使用自签名证书(包括中间 CA)部署 Spring Boot 应用程序

git - 使用https时如何通过防火墙访问Github扮演中间人?

linux - 如何在终端钥匙串(keychain)中的 Linux 上存储你的 github https 密码?

macos - OSX 10.10 无需密码即可导入 .pfx?