带有 X509 证书的 Ruby 中的 SOAP 请求
我正在使用 Soap4r 和 HTTPClient 与 Web 服务交互。该服务仅接受已使用 X509 证书进行数字签名的请求。我已经完成了生成私钥、获取证书请求 (CSR) 以及从权威机构(托管 Web 服务的公司)获取实际证书的步骤。
是否有任何示例说明如何执行此操作?
I am using Soap4r and HTTPClient to interact with a Webservice. The Service only accepts requests which have been digitally signed with an X509 certificate. I have gone through the steps of generating a private key, getting the certificate request ( CSR ) and getting the actual certificate from the authority ( the company hosting the web service. )
Are there any examples out there for how to do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您正在使用的网络服务似乎使用 WS-安全性。 WS-Security 是一个 OASIS 标准,它利用 XML 签名和 XML 加密来保护 SOAP 消息的安全。但是,据我所知,Soap4r 不支持 WS-Security。自己实现它是非常没有希望的,因为它相当复杂(并且涉及诸如 XML 规范化之类烦人的东西)。
WSO2 的框架有 ruby 绑定 (http://wso2.org/projects/wsf/ruby )也许你可以用它。如果没有,您可能需要包装一些 C 库(如 libxmlsec)来对 Soap4r 创建的消息进行签名。有 ruby 绑定 (http://rubygems.org/gems/xmlsec-ruby)但我认为它们没有公开 xmlsec 的全部功能。
如果这是一个选项,您可以用 Java 实现代码,因为它有很多功能强大的开源 SOAP 库,支持 WS-Security,如 Metro (http://metro.java.net/),Axis2 (http:// ws.apache.org/axis2/)和 CXF(http://cxf.apache.org/)
It seems that the webservice you are consuming uses WS-Security. WS-Security is a OASIS standard that utilizes XML-Signature and XML-Encryption to secure SOAP-Messages. However, as far as I know Soap4r does not support WS-Security. Implementing it yourself is pretty hopeless since it is rather complex (and involves annoying stuff like XML-Canonicalization).
WSO2 has ruby bindings for their framework (http://wso2.org/projects/wsf/ruby) maybe you could use it. If not you will probably have to wrap some C library (like libxmlsec) to sign the messages created by Soap4r. There are ruby bindings (http://rubygems.org/gems/xmlsec-ruby) for it but I think they do not expose the full functionality of xmlsec.
If this is an option you could implement your code in Java as it has quite a few powerful open source SOAP libraries with support for WS-Security like Metro (http://metro.java.net/), Axis2 (http://ws.apache.org/axis2/) and CXF (http://cxf.apache.org/)