首页 文章

WCF服务证书身份验证

提问于
浏览
4

当wcf服务将使用证书时,那么将使用wcf服务的客户端将如何将证书发送到wcf服务 . 这个想法对我来说并不清楚,当wcf客户端第一次调用wcf服务时,客户端将如何发送服务证书?请讨论人们如何使用wcf和证书 .

还简要指导一下,我们需要采取哪些步骤来将证书与我们的wcf服务相关联?

wcf客户端如何在打电话时将证书发送给wcf服务?

我们是否需要在wcf客户端配置证书?

一个人告诉我

在wcf中使用证书身份验证时,则在服务端和客户端,您需要安装服务证书和客户端证书 . 然后在客户端,客户端将使用服务公钥来加密消息并发送到服务,然后服务将使用服务私钥来解密消息 . 在服务端,它将使用客户端公钥来加密消息并发送给客户端 . 然后客户端将使用客户端私钥来解密消息 .

如果这是我们需要在两端安装证书的证书身份验证的限制,那么我们可以在非常有限的情况下使用证书身份验证 . 当我们无法控制将使用该服务的客户端时,告诉我如何使用证书身份验证 . 当客户不知道时,他们如何将证书发送到我们的服务 .

actually i am trying to know how people manage to implement certificate authentication in real life when they do not have a control over the client who will be using their service. 谢谢

1 回答

  • 2

    好的,您正在寻找您的潜在客户的客户端证书身份验证,这些客户端始终包含SSL .

    我有几个链接供您查看:

    http://msdn.microsoft.com/en-us/library/ms731074(v=vs.110).aspx是来自MS的官方版本,它具有良好的信息,但不一定是关于使其正常工作的良好说明 .

    http://architecturebyashwani.blogspot.de/2010/01/wcf-client-authentication-using-x509.html ...在我看来,这是一个更好的来源,因为它将引导您完成设置您需要进行测试的证书(自签名)的过程 .

    至于控制发布和证书到客户端计算机,这可能是容易的或困难的,这取决于涉及多少客户端设备以及它们位于何处 .

    如果您正在讨论网络中服务器到服务器通信的内部实现,或者可能是连接到主机的几台PC,那并不难 . 简而言之,您将.PFX文件(证书和私钥)复制到客户端和主机并在证书存储区中设置它们(例如,像LocalComputer \ Trusted) . 然后设置客户端和主机WCF软件,以便a)访问证书和b)使主机拒绝访问未经身份验证的用户 .

    但是,如果您正在谈论为使用iPhone,机器人和笔记本电脑走动的一千人发放和管理证书,那么控制这个问题要困难得多 .

    不过,这里有一个关于设置内部证书颁发机构的链接:http://technet.microsoft.com/en-us/library/ff849263(v=ws.10).aspx

    补充:此DOS脚本将创建客户端身份验证证书,将它们打包为PFX并将它们安装到主机上的证书存储中 .

    在主机端,您执行此操作:

    rem Comment -- creates client authentication cert, puts it in the currentuser\root authority and signs it based on the other certificate
     makecert.exe  -n cn=ClientAuthCert ClientAuthCert.cer -is root -sky exchange -pe -sv ClientAuthCert.pvk -eku 1.3.6.1.5.5.7.3.2
    
     rem Comment -- make the pfx file that will allow you to copy certs around with private keys
     pvk2pfx -pvk ClientAuthCert.pvk -spc ClientAuthCert.cer -pfx ClientAuthCert.pfx -f
    
     rem Comment -- installs the certificate on the host in the localmachine / trusted people store
     certmgr.exe -add ClientAuthCert.cer  -c -s -r LocalMachine TrustedPeople
    

    在客户端,您执行此操作(将.CER和.PFX文件复制到客户端计算机后):

    rem comment -- these lines install the certificates in the stores on the client device
     certmgr.exe -add ClientAuthCert.cer  -c -s -r LocalMachine TrustedPeople
     Certmgr.exe -add ClientAuthCert.pfx  -c -s -r CurrentUser My
    

相关问题