WCF X.509验证
1.证书的制作
makecert.exe -sr LocalMachine -ss My -a sha1 -n CN=ParkingServer -sky exchange -pe
makecert.exe -sr LocalMachine -ss My -a sha1 -n CN=ParkingClient -sky exchange -pe
注意:证书制作完后还要对相应的证书读取权限作配置。
WCF取用X.509证书,服务端和客户端都要作相应的修改。
2.服务端的修改
behavior节点:
<behavior name="CustomBehavior">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceCredentials>
<clientCertificate>
<authentication certificateValidationMode="None" />
</clientCertificate>
<serviceCertificate findValue="ParkingServer" storeLocation="LocalMachine"
storeName="My" x509FindType="FindBySubjectName" />
</serviceCredentials>
</behavior>
binding节点
<wsHttpBinding>
<binding name="CustomWsHttpBinding">
<security mode="Message">
<message clientCredentialType="Certificate"/>
</security>
</binding>
</wsHttpBinding>
service节点
<service name="WcfService1.Service1" behaviorConfiguration="CustomBehavior">
<endpoint address="" binding="wsHttpBinding" bindingConfiguration="CustomWsHttpBinding"
contract="WcfService1.IService1">
<identity>
<dns value="ParkingServer" />
</identity>
</endpoint>
<endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
</service>
3.客户端的修改
client-endpoint节点
<endpoint address="http://localhost:60909/Service2.svc" binding="basicHttpBinding" behaviorConfiguration="CustomBehavior2"
bindingConfiguration="BasicHttpBinding_IService2" contract="ServiceReference2.IService2"
name="BasicHttpBinding_IService2">
<identity>
<dns value="ParkingServer" />
</identity>
</endpoint>
bindings节点
<basicHttpBinding>
<binding name="BasicHttpBinding_IService2">
<security mode="Message">
<message clientCredentialType="Certificate" />
</security>
</binding>
</basicHttpBinding>
behavior节点
behavior节点,wsHttpBindings和basicHttpBindings的绑定内容有所不同。basicHttpBindings多一个defaultCertificate的配置
basicHttpBindings
<behavior name="CustomBehavior2">
<clientCredentials>
<clientCertificate findValue="zoesoft"
x509FindType="FindBySubjectName"
storeLocation="LocalMachine"
storeName="My"/>
<serviceCertificate>
<authentication certificateValidationMode="None"/>
<defaultCertificate findValue="ParkingServer" storeName="My" storeLocation="LocalMachine" x509FindType="FindBySubjectName"/>
</serviceCertificate>
</clientCredentials>
</behavior>
wsHttpBindings
<behavior name="CustomBehavior">
<clientCredentials>
<clientCertificate findValue="zoesoft"
x509FindType="FindBySubjectName"
storeLocation="LocalMachine"
storeName="My"/>
<serviceCertificate>
<authentication certificateValidationMode="None"/>
</serviceCertificate>
</clientCredentials>
</behavior>
参考:
WCF开发框架形成之旅--如何实现X509证书加密
Invoke WCF service from Java Client with Authentication (X.509 Certificate) Java 客户端调用WCF服务 需要安全验证
WCF X.509验证的更多相关文章
- Nginx集群之WCF分布式身份验证(支持Soap)
目录 1 大概思路... 1 2 Nginx集群之WCF分布式身份验证... 1 3 BasicHttpBinding.ws2007HttpBinding. 2 4 ...
- WCF X.509证书双向认证小结
最近在学习WCF X.509证书验证,想实现使用证书实现服务端和客户端的双向认证,实现原理是利用了数字证书包含的一对非对称密钥来实现数字签名及加密.所谓非对称密钥是采用两个密钥将加密和解密能力分开:一 ...
- 重温WCF之WCF传输安全(十三)(3)基于SSL的WCF对客户端验证(转)
转载地址:http://www.cnblogs.com/lxblog/archive/2012/09/18/2690719.html 上文我们演示了,客户端对服务器端身份的验证,这一篇来简单演示一下对 ...
- WCF用户名密码验证方式
WCF使用用户名密码验证 服务契约 namespace WCFUserNameConstract { [ServiceContract] public interface IWcfContract { ...
- 关于WEB Service&WCF&WebApi实现身份验证之WCF篇(1)
WCF身份验证一般常见的方式有:自定义用户名及密码验证.X509证书验证.ASP.NET成员资格(membership)验证.SOAP Header验证.Windows集成验证.WCF身份验证服务(A ...
- C# 实现身份验证之WCF篇(1)
WCF身份验证一般常见的方式有:自定义用户名及密码验证.X509证书验证.ASP.NET成员资格(membership)验证.SOAP Header验证.Windows集成验证.WCF身份验证服务(A ...
- WCF之添加自定义用户名密码认证
1.创建WCF服务应用以及调用客户端(请自行google). 2.创建X509证书 cmd 进入 C:\Program Files\Microsoft SDKs\Windows\v6. ...
- WCF分布式开发步步为赢(14):WCF安全编程--基本概念
WCF安全机制是个非常复杂的问题,因为涉及的知识点较多,所以今天这个文章,会分析进行WCF安全开发应该了解的哪些知识点.如何查看资料.为了更好地理解WCF安全相关知识,我把WCF安全机制主要知识点整理 ...
- 重温WCF之发送和接收SOAP头(三)
SOAP头可以理解为一种附加信息,就是附加到消息正文的内容. 既然消息头是附加信息,那有啥用呢?你可别说,有时候还真有不少用处.举个例子,WCF的身份验证是不是很麻烦?还要颁发什么证书的(当然不是荣誉 ...
随机推荐
- [CareerCup] 9.8 Represent N Cents 美分的组成
9.8 Given an infinite number of quarters (25 cents), dimes (10 cents), nickels (5 cents) and pennies ...
- <转>卷积神经网络是如何学习到平移不变的特征
After some thought, I do not believe that pooling operations are responsible for the translation inv ...
- JS组件系列——开源免费图表组件:Chart.js
前言:最近被开源免费得有点上火了,各种组件首先想到的就是是开源否.是否免费.是否和bootstrap风格一致.想着以后做报表肯定要用到图表组件的,于是在Bootstrap中文网上面找到了Chart.j ...
- 查看SQL Server被锁的表以及如何解锁
锁定数据库的一个表的区别 SELECT * FROM table WITH (HOLDLOCK) 其他事务可以读取表,但不能更新删除 SELECT * FROM table WITH (TABLOCK ...
- CentOS 6.8_x64 Oracle 12C 安装
1.下载地址 (需要注册oracle账号) 点击 2.登录CentOS 做准备工作 groupadd oinstall groupadd dba useradd -g oinstall -g dba ...
- 放下恩怨,曝小米中兴投关键性一票让华为顺利取得5G短码控制权
如果说最近国内科技公司最牛逼最令人振奋的新闻是啥,显然,就是两天前在3GPP RAN1 87次会议的5G短码方案讨论中,华为顺利碾压高通,战胜列强,拿下了5G的控制编码方案的标准. 虽然说,目前,华为 ...
- elk系列5之syslog的模块使用
preface rsyslog是CentOs系统自带的的一个日志工具,那么我们就配置logstash来接受rsyslog的日志. logstash的syslog模块 linux-node2上操作 lo ...
- Spring JdbcTemplate 方法详解
JdbcTemplate主要提供以下五类方法: execute方法:可以用于执行任何SQL语句,一般用于执行DDL语句: update方法及batchUpdate方法:update方法用于执行新增.修 ...
- centos 软件包安装与管理
http://rpmfind.net/linux/RPM/index.html http://pkgs.org/ https://sourceforge.net/
- Canvas绘制图形
1.Canvas绘制一个蓝色的矩形 <!DOCTYPE html> <html> <head lang="en"> <meta chars ...