Subject: Failed to decrypt saml assertion
Date: 2016-01-19 18:38:26
From: Craig Boucher
Source: failed-decrypt-saml-assertion
----------------------------------------------------------------------

I’m getting the following error decrypting the assertions.  

2016-01-19 10:06:17,715 [62] ERROR ParkingPermits.AssertionService - Error logging in:

ComponentPro.Saml.SamlException: Failed to decrypt saml assertion. ---> ComponentPro.Saml.SamlException: Failed to decrypt saml assertion. ---> ComponentPro.Saml.SamlException: Failed to decrypt xml.

   at c_XOA.c_WKC(XmlElement c_NFU, XmlNodeList c_OFU, AsymmetricAlgorithm c_PFU, EncryptionMethod c_EFU, EncryptionMethod c_FFU)

   at ComponentPro.Saml2.EncryptedAssertion.DecryptToXmlElement(AsymmetricAlgorithm keyDecryptingKey, EncryptionMethod keyEncryptionMethod, EncryptionMethod dataEncryptionMethod)

   --- End of inner exception stack trace ---

   at ComponentPro.Saml2.EncryptedAssertion.DecryptToXmlElement(AsymmetricAlgorithm keyDecryptingKey, EncryptionMethod keyEncryptionMethod, EncryptionMethod dataEncryptionMethod)

   at ComponentPro.Saml2.EncryptedAssertion.Decrypt(AsymmetricAlgorithm keyDecryptingKey, EncryptionMethod dataEncryptionMethod)

   --- End of inner exception stack trace ---

   at ComponentPro.Saml2.EncryptedAssertion.Decrypt(AsymmetricAlgorithm keyDecryptingKey, EncryptionMethod dataEncryptionMethod)

   at ShibbolethLib.SamlResponse.get_samlAssertions() in D:\Users\CBoucher.CSUS2100\Documents\My Projects\ParkingPermits\VS2013\ParkingPermits\ShibbolethLib\SamlResponse.cs:line 34

   at ShibbolethLib.SamlResponse.get_Email() in D:\Users\CBoucher.CSUS2100\Documents\My Projects\ParkingPermits\VS2013\ParkingPermits\ShibbolethLib\SamlResponse.cs:line 65

   at ParkingPermits.AssertionService.Page_Load(Object sender, EventArgs e) in D:\Users\CBoucher.CSUS2100\Documents\My Projects\ParkingPermits\VS2013\ParkingPermits\ParkingPermits\AssertionService.aspx.cs:line 169

Here is the SAMLRequest:

Here is the SAMLResponse:

Here is my code:

[code lang='c#']

private Assertion _samlAssertions;

        private Assertion samlAssertions

        {

            get

            {

                if (_samlAssertions == null)

                {

                    if (samlResponse.GetAssertions().Count > 0)

                        _samlAssertions = samlResponse.GetAssertions()[0];

                    else if (samlResponse.GetEncryptedAssertions().Count > 0)

                    {

                        _samlAssertions = samlResponse.GetEncryptedAssertions()[0].Decrypt(Certificates.SpCertificate.PrivateKey, null);

                    }

                    else

                        throw new ApplicationException("No assertions in response");

                }

                return _samlAssertions;

            }

        }[/code]

Any help would be greatly appreciated.

Thanks,

Craig

---------------------------------------------------------------------- Note: This question has been asked on the Q&A forum of Thang Dang's fraudulent ComponentPro brand If you purchased anything from ComponentPro, you have been scammed. Contact the payment processor who sold you the license and ask for your money back. Back to ComponentPro Q&A Forum Index