0
如何验证我的WCF消息是否已签名?我的安装程序运行正常,但需要能够检查服务器端的签名。这是如何完成的?我正在使用MsmqIntegrationBinding,并使用X509Certificate2对其进行签名。如何验证我的WCF消息是经过签名和加密的?
var binding = new MsmqIntegrationBinding(MsmqIntegrationSecurityMode.Transport)
{
SerializationFormat = MsmqMessageSerializationFormat.Binary,
Security = new MsmqIntegrationSecurity()
{
Mode = MsmqIntegrationSecurityMode.Transport,
Transport = new MsmqTransportSecurity()
{
MsmqAuthenticationMode = MsmqAuthenticationMode.Certificate,
MsmqProtectionLevel = System.Net.Security.ProtectionLevel.Sign
}
}
};
EndpointAddress address = new EndpointAddress("myaddress");
ChannelFactory<IMyMessage> channelFactory = new ChannelFactory<IMyMessage>(binding, address);
channelFactory.Credentials.ClientCertificate.Certificate = my_x509certificate2;
IMyMessage channel = channelFactory.CreateChannel();
//create message and send using the channel
嗯,可能是签字不工作。我现在收到一个错误:“请求消息必须被保护,这是合约操作所要求的...保护必须由绑定提供('MsmqIntegrationBinding','http://tempuri.org/')。 “ – Random 2013-03-22 20:01:16
这就是这个注释的作用,它需要在调用操作之前在服务器端进行签名和加密。 – 2013-03-22 20:34:49
因此,现在我必须确定为什么它没有按照我设置的方式发生。 – Random 2013-03-25 15:45:40