ind*_*dra 24 iis-7 client-certificates ssl-certificate windows-7
我正在尝试在IIS7上运行的Web应用程序上设置双向身份验证.客户端主要是移动设备,首先我试图使用第三代iPad运行演示.我以为我首先要让它在我的工作站上运行(也运行IIS),然后通过iPad复制工作证书.
但是我撞墙了.
我已经让网站通过https安全运行并安装了自签名服务器证书,但我似乎无法弄清楚如何生成我可以在iPad上安装的客户端证书.当我在运行Windows 7的本地工作站上工作时,我无法使用通常的方法http://machinename/CertSvr来执行此操作.
所以我想知道是否有办法makecert生成测试客户端证书,或者我是否可以更改服务器证书中的使用标志,使其适合在客户端上使用.或者也许还有一些工具,谷歌的最后一天还没有发现?
更新:
我找到了这个指南并跟着它来了.这一切似乎工作,没有错误,我结束了两个PFX文件,一个用于服务器和一个客户端(我产生这些使用pvk2pfx,并保持原有的.pvk和.cer以防万一的文件).
我安装了服务器证书Certificates (Local Computer) > Trusted Root Certification Authority并在其下安装了客户端证书Certificates (Current User) > Personal.我还将服务器证书(CA一个)导入IIS.当IIS配置为接受或忽略客户端证书时,一切正常.但是一旦设置为'Require',我在申请该网站时会得到403.7.我也尝试将客户端证书导入到IE/Chrome中的证书存储区,但同样没有骰子.
有什么明显的东西我做错了吗?
在本地 IIS Express上启用客户端证书:
将 \YourSlnFolder\.vs\config\applicationhost.config -> 更改<section name="access" overrideModeDefault="Deny" />为<section name="access" overrideModeDefault="Allow" />
<sectionGroup name="system.webServer">
...
<sectionGroup name="security">
...
<section name="access" overrideModeDefault="Allow" />
Run Code Online (Sandbox Code Playgroud)
然后像这样编辑你的 Web.config:
<configuration>
<system.webServer>
<security>
<access sslFlags="SslRequireCert" />
</security>
</system.webServer>
</configuration>
Run Code Online (Sandbox Code Playgroud)
在IIS上启用客户端证书:
转到 IIS 管理器中的网站,然后单击“SSL 设置”。然后将应用程序设置为“需要 SSL”和“需要客户端证书”。
启动 VS 开发人员命令提示符
makecert.exe -r -n "CN=TestRootCertificate" -pe -sv TestRootCertificate.pvk -a sha1 -len 2048 -b 01/01/2017 -e 01/01/2030 -cy authority TestRootCertificate.cer
Run Code Online (Sandbox Code Playgroud)
输入您的密码。
创建证书吊销列表 (CRL)
makecert -crl -n "CN=TestRootCertificate" -r -sv TestRootCertificate.pvk TestRootCertificate.crl
Run Code Online (Sandbox Code Playgroud)
捆绑到 .pfx(pvk2pfx.exe 需要为 VS2017 安装“使用 C++ 进行桌面开发”)
pvk2pfx.exe -pvk TestRootCertificate.pvk -pi {password} -spc TestRootCertificate.cer -pfx TestRootCertificate.pfx
Run Code Online (Sandbox Code Playgroud)
makecert.exe -ic TestRootCertificate.cer -iv TestRootCertificate.pvk -pe -sv localtestclientcert.pvk -a sha1 -n "CN=localtestclientcert" -len 2048 -b 01/01/2015 -e 01/01/2030 -sky exchange localtestclientcert.cer -eku 1.3.6.1.5.5.7.3.2
Run Code Online (Sandbox Code Playgroud)
输入您的密码。
pvk2pfx.exe -pvk localtestclientcert.pvk -pi {password} -spc localtestclientcert.cer -pfx localtestclientcert.pfx
Run Code Online (Sandbox Code Playgroud)
导入证书。
启动mmc.exe。
File -> Add or Remove Snap-ins -> Certificates -> Add -> Computer account -> Local computer
Certificates (Local Computer) -> Personal -> Certificates -> Right click -> All tasks -> Import -> localtestclientcert.pfx
Certificates (Local Computer) -> Trusted Root Certification Authorities -> Certificates -> Right click -> All tasks -> Import -> RootCertificate.cer
Run Code Online (Sandbox Code Playgroud)
用于浏览器中的身份验证:
File -> Add or Remove Snap-ins -> Certificates -> Add -> My user account
Certificates - Current User -> Personal -> Certificates -> Right click -> All tasks -> Import -> localtestclientcert.pfx
Run Code Online (Sandbox Code Playgroud)
现在访问您的站点需要服务器信任的客户端证书:
如果您遵循本指南并收到如下错误:
HTTP Error 500.19 - Internal Server Error
The requested page cannot be accessed because the related configuration data for the page is invalid.
Run Code Online (Sandbox Code Playgroud)
或者
HTTP Error 403.7 - Forbidden
The page you are attempting to access requires your browser to have a Secure Sockets Layer (SSL) client certificate that the Web server recognizes.
Run Code Online (Sandbox Code Playgroud)
您可能需要重新启动计算机。请注意,关闭 iisexpress 进程或 Visual Studio 是不够的。无需重新启动即可解决此500.19问题,但证书很棘手,因此建议的方法是重新启动计算机。
如果您收到错误,The request was aborted: Could not create SSL/TLS secure channel可能是由于应用程序池无权访问特定证书。
证书(本地计算机)-> 个人 -> 证书 -> localtestclientcert -> 右键单击 -> 所有任务 -> 管理私钥 -> 添加IIS APPPOOL\YourWebSite并授予其完全控制权。
| 归档时间: |
|
| 查看次数: |
64905 次 |
| 最近记录: |