如何阅读加密断言?

How to read encrypted assertions?

我正在编写 SAML2 服务 provider/relying。我的 IdP 以加密形式返回断言(EncryptedAssertion 元素)。 ITfoxtec.Identity.Saml2支持这个Assertion解密场景吗?我收到此异常:

ITfoxtec.Identity.Saml2.Saml2RequestException: There is not exactly one Assertion element.
   at ITfoxtec.Identity.Saml2.Saml2AuthnResponse.GetAssertionElementReference()
   at ITfoxtec.Identity.Saml2.Saml2AuthnResponse.GetAssertionElement()
   at ITfoxtec.Identity.Saml2.Saml2AuthnResponse.Read(String xml, Boolean validateXmlSignature)
   at ITfoxtec.Identity.Saml2.Saml2PostBinding.Read(HttpRequest request, Saml2Request saml2RequestResponse, String messageName, Boolean validateXmlSignature)
   at ITfoxtec.Identity.Saml2.Saml2Binding`1.ReadSamlResponse(HttpRequest request, Saml2Response saml2Response)

谢谢!

终于明白了!我只需要设置 Saml2Configuration.DecryptionCertificate.