Mar*_*ark 3 security service wcf token wif
我正在使用 .NET 4.5 和基于令牌的安全性来实现 WCF 服务。在客户端,我使用myfact.CreateChannelWithIssuedToken()
之前从 STS 检索到的令牌进行调用,当我使用此通道调用服务时,我收到以下错误(在 WCF 服务跟踪中):
Cannot resolve KeyInfo for decryption: KeyInfo 'SecurityKeyIdentifier
(
IsReadOnly = False,
Count = 1,
Clause[0] = EncryptedKeyIdentifierClause(EncryptedKey = qDJDOHUxLxDP8/5baRbY6LrnIX2cYLGwC8b9xDQbEfLsYhcowtszecfWK93dFQHBNV+COHSZpKapJlzrbi12QlObuhfpB08vIxrgXCLg69w4PfAq/jzJcK3N16GHHADSE6XT0KVBXQbcwJqyrELLGAc9ve3cnn52EDg6rkVKBNg=, Method 'http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p')
) ', available tokens 'System.ServiceModel.Security.AggregateSecurityHeaderTokenResolver'.
Run Code Online (Sandbox Code Playgroud)
我怀疑这是因为该服务无法解密传入的安全令牌,但我不知道为什么会这样。该证书位于 LocalMachine\My 存储中,并具有关联的私钥。
WCF 如何找到必要的证书,以及为什么在我的情况下无法找到它?
原来是使用的服务证书。当我纠正这个问题时(通过<serviceCertificate .../>
旋钮:
<behavior name="my_service_behavior">
<serviceCredentials useIdentityConfiguration="true" identityConfiguration="identity">
<serviceCertificate
findValue="..."
x509FindType="FindByThumbprint"
storeName="My"
storeLocation="LocalMachine" />
</serviceCredentials>
</behavior>
Run Code Online (Sandbox Code Playgroud)
一切都开始运转了。