简体   繁体   English

WCF 通过证书识别客户端的服务

[英]WCF Service that identifies client by certificate

we've got a WCF Service using BasicHttpBinding with server- and client-certificates.我们有一个使用带有服务器和客户端证书的 BasicHttpBinding 的 WCF 服务。 We are using Transport security:我们正在使用传输安全性:

<security mode="Transport">
  <transport clientCredentialType="Certificate" />
</security>

So far everything works (client calls a webmethod and is only allowed to, if the client certificate is issued by the trusted CA).到目前为止一切正常(客户端调用 web 方法,并且只有在客户端证书由受信任的 CA 颁发时才允许这样做)。

Now we want to check in the WCF service, if the client certificate is a specific certificate.现在我们要检查 WCF 服务,如果客户端证书是特定证书。 The certificate we are looking for is known (installed on) the server, too.我们正在寻找的证书也是已知的(安装在服务器上)。

How do we get the used client certificate in the service code?我们如何在服务代码中获取使用的客户端证书? How do we load the certificate we want to compare to?我们如何加载我们想要比较的证书? How do we compare?我们如何比较?

Haven't actually tried this myself but the technique shown in this MSDN article seems to be what you're looking for.我自己实际上并没有尝试过,但这篇 MSDN 文章中显示的技术似乎正是您正在寻找的。 It explains how to create a custom certificate validator, (didn't know this was possible).它解释了如何创建自定义证书验证器,(不知道这是可能的)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM