应用WSDK - 实践Web Services的数字签名(下)
2002-12-10 09:07
357 查看
应用WSDK - 实践Web Services的数字签名<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />
小气的神
2002-12-05
Article Type: In-Depth
难度等级:8.2/9
版本:1.36
生成客户端部分
1. 创建一个WinForm的Windows Application
2. 创建用户界面
<?xml:namespace prefix = v ns = "urn:schemas-microsoft-com:vml" />
3. 加入Web Services的引用。
然后点击Add Exit Item->选择Tmp目录->加入SignSOAPWebServices.cs 文件确定。
4. 修改SignSOAPWebServices.cs 文件
5. 在Form1中加入调用 Web Services的代码
6. 编译并运行程序
分析结果
之后我们使用 SOAP Toolkit 3.0 的Trace Utility 进行观察可以发现下面的Dump
看得出我们整个的过程是这样的:
综上所叙述,我们看到我们能够利用WSDK实现Web Services有关Security的实现,最重要的是WS-Security对于Web Services安全性方面提供了一个高层和最基本的定义。
“WS-Security is flexible and designed to be used as the basis for securing XML Web services through the combination of a wide variety of security models, including public key infrastructure (PKI), Kerberos, and Secure Sockets Layer (SSL). Correspondingly, many types of security tokens can be propagated, such as X.509 certificates and Kerberos tickets. Additionally, the specification provides support for propagating multiple security tokens across multiple trust domains using multiple signature formats and multiple encryption technologies.”
好吧,我很愿意用这段话说明WS-Security也愿意用这段话作为本文的结束,看得出Web Services 安全性的问题非常复杂和有趣,我想还有许多许多新的内容在等着我们。
相关文件下载: [WSDKSignSOAPUsing.zip 26K]
特别:
本文原创,CSDN署名首发,所有文字和图片版权所有。未经授权请勿传播、转载或改编。
如果有问题或建议,请发电子邮件给new2001@msn.com
欢迎访问我的WebSite:www.dotNETTools.org
小气的神
2002-12-05
Article Type: In-Depth
难度等级:8.2/9
版本:1.36
生成客户端部分
1. 创建一个WinForm的Windows Application
2. 创建用户界面
<?xml:namespace prefix = v ns = "urn:schemas-microsoft-com:vml" />
3. 加入Web Services的引用。
cd/tmp wsdl /l:cs /out:SignSOAPWebServices.cs /n:SignSOAPSvc /urlkey:SecurityURL http://localhost/Myproject/WSDK/SignSOAPUsingName/SignSOAPusingName.asmx?WSDK |
然后点击Add Exit Item->选择Tmp目录->加入SignSOAPWebServices.cs 文件确定。
4. 修改SignSOAPWebServices.cs 文件
加入Microsoft.WebServices.DLL 引用和下面的代码 using Microsoft.Web.Services.Security ; using Microsoft.Web.Services; 并将 System.Web.Services.Protocols.SoapHttpClientProtocol 替换为 Microsoft.Web.Services.WebServicesClientProtocol |
5. 在Form1中加入调用 Web Services的代码
private void btnCallWebservice_Click(object sender, System.EventArgs e) { try { string username = Environment.UserName ; byte[] passwordBytes = System.Text.Encoding.UTF8.GetBytes( username ) ; Array.Reverse( passwordBytes ) ; string passwordEquivalent = Convert.ToBase64String( passwordBytes ) ; UsernameToken userToken = new UsernameToken( username, passwordEquivalent, PasswordOption.SendHashed ) ; SignSOAPSvc.SignSOAPWebServices Svc = new SignSOAPSvc.SignSOAPWebServices() ; Svc.RequestSoapContext.Timestamp.Ttl = 60000 ; Svc.RequestSoapContext.Security.Tokens.Add( userToken ) ; Svc.RequestSoapContext.Security.Elements.Add( new Signature( userToken ) ) ; lblCallRet.Text = Svc.HelloWorld() ; } catch ( System.Web.Services.Protocols.SoapException soapex ) { MessageBox.Show ( soapex.ToString() ) ; } catch ( Exception ex ) { MessageBox.Show( ex.ToString() ) ; } } |
6. 编译并运行程序
分析结果
之后我们使用 SOAP Toolkit 3.0 的Trace Utility 进行观察可以发现下面的Dump
看得出我们整个的过程是这样的:
综上所叙述,我们看到我们能够利用WSDK实现Web Services有关Security的实现,最重要的是WS-Security对于Web Services安全性方面提供了一个高层和最基本的定义。
“WS-Security is flexible and designed to be used as the basis for securing XML Web services through the combination of a wide variety of security models, including public key infrastructure (PKI), Kerberos, and Secure Sockets Layer (SSL). Correspondingly, many types of security tokens can be propagated, such as X.509 certificates and Kerberos tickets. Additionally, the specification provides support for propagating multiple security tokens across multiple trust domains using multiple signature formats and multiple encryption technologies.”
好吧,我很愿意用这段话说明WS-Security也愿意用这段话作为本文的结束,看得出Web Services 安全性的问题非常复杂和有趣,我想还有许多许多新的内容在等着我们。
相关文件下载: [WSDKSignSOAPUsing.zip 26K]
特别:
本文原创,CSDN署名首发,所有文字和图片版权所有。未经授权请勿传播、转载或改编。
如果有问题或建议,请发电子邮件给new2001@msn.com
欢迎访问我的WebSite:www.dotNETTools.org
相关文章推荐
- 应用WSDK - 实践Web Services的数字签名(上)
- 应用WSDK - 实践Web Services的X.509证书签名(序)
- 应用WSDK-实现和使用DIME的Web Services(下)
- 应用WSDK - 实践WebServices的路由和路由选择(上)
- 应用WSDK - 实践WebServices的路由和路由选择(下)
- 应用WSDK - 实践WebServices的路由和路由选择(上)
- 蘑菇街11.11:私有云平台的Docker应用实践
- 《Windows PowerShell 2.0应用编程最佳实践》已出版上市,同时将在台湾出版
- 腾讯万台规模的Docker应用实践
- 使用LoadRunner 11针对Web Services协议脚本的应用
- RoR企业应用实践之一:移植物资管理系统
- Vuex2.0+Vue2.0构建备忘录应用实践
- Nginx配置支持https协议-应用实践
- 第9周实践项目3-稀疏矩阵的三元组表示的应用(3.2)
- Redux-Saga在React工程架构之的应用实践详解
- web services 应用场景
- 浅谈Android应用内悬浮控件实践方案总结
- JQuery最佳实践:JQuery自定义事件的应用
- 8 个构建容器应用的最佳实践
- ORB_SLAM2应用实践_ROS小强机器人