我正在使用 .NET 4.5 和基于 token 的安全性实现 WCF 服务。在客户端,我使用之前从 STS 检索到的 token 调用 myfact.CreateChannelWithIssuedToken()
,当我使用此 channel 调用服务时,出现以下错误(在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'.
我怀疑这是因为服务无法解密传入的安全 token ,但我不知道为什么会这样。该证书位于 LocalMachine\My 存储中,并具有关联的私钥。
WCF 如何找到必要的证书,为什么在我的案例中找不到它?
最佳答案
原来用的是服务证书。当我更正此问题时(通过 <serviceCertificate .../>
旋钮:
<behavior name="my_service_behavior">
<serviceCredentials useIdentityConfiguration="true" identityConfiguration="identity">
<serviceCertificate
findValue="..."
x509FindType="FindByThumbprint"
storeName="My"
storeLocation="LocalMachine" />
</serviceCredentials>
</behavior>
一切开始工作。
关于wcf - WCF 服务如何知道使用什么证书来解密传入的安全 token ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15421086/