如何验证我的 WCF 消息是否已签名?我的设置运行正常,但需要能够检查服务器端的签名。这是怎么做到的?我正在使用 MsmqIntegrationBinding,并使用 X509Certificate2 对其进行签名。
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