我需要使用WS Security将NET Framework 4客户端应用程序连接到部署在Apache CXF上的Web服务。这项服务是我无法控制的。该服务将作为“服务参考”添加到项目中。这是代理:ServicePointManager.ServerCertificateValidationCallback = New System.Net.Security.RemoteCertificateValidationCallback(AddressOf AcceptAllCertifications) Dim oBinding As New CustomBinding()Dim oSecurity As SecurityBindingElementoSecurity = AsymmetricSecurityBindingElement.CreateCertificateOverTransportBindingElement(MessageSecurityVersion.WSSecurity11WSTrust13WSSecureConversation13WSSecurityPolicy12BasicSecurityProfile10)oSecurity.IncludeTimestamp = TrueoBinding.Elements.Add(oSecurity)oBinding.Elements.Add(New CertFixEscapedComma.CertRefEncodingBindingElement()) ( This a custom message encoder)CertFixEscapedComma.CertRefEncoder.CERTIFICADO = Convert.ToBase64String(oCertificado.RawData) oBinding.CloseTimeout = New TimeSpan(0, 2, 0)Dim oTransport As New HttpsTransportBindingElement()oBinding.Elements.Add(oTransport)Dim oProxyClient As New NameServiceClient(oBinding, New System.ServiceModel.EndpointAddress(New Uri("https://url_service")))Dim oCertificado As X509Certificate2oCertificado = function_client_certificate() ' this get the proper certoProxyClient.ClientCredentials.ClientCertificate.Certificate = oCertificadooProxyClient.name_function(params) 'call to the remote service因此,在“ unwrappingToken = resolver.ExpectedWrapper”中,我得到一个“空”。这可能是某种“消息名称空间不匹配”,或者类似的东西,我看不到吗?证明还可以,并且有效。它具有x509v3的所有属性,并且发行者是受信任的发行者...
2 回答
MMMHUHU
TA贡献1834条经验 获得超8个赞
我认为肥皂信息是错误的。该wsse:Reference
元素包含一个不存在的URI:URI = “#EK-4A5A4F8820EFD673E7152328322340610394”。通常,此URI应该引用一个wsse:BinarySecurityToken
具有与wsu:Id
此URI对应的值的元素。您的肥皂回复似乎缺少此信息。
该wsse:BinarySecurityToken
元素包含x509证书,或者在您情况下包含对其的引用。由于无法解析URI,因此您的客户端无法确定要使用的x509证书。
- 2 回答
- 0 关注
- 144 浏览
添加回答
举报
0/150
提交
取消