Subject: Missing signature nodes?
Date: 2013-07-03 16:56:53
From: Greg Griffin
Source: missing-signature-nodes

The consumer of my SAML assertion is telling me that 'the “//saml:Assertion//ds:Signature' or '//saml:Assertion//Signature' xml node is used to validate the certificate and this is missing".

My code is as follows - what am I missing?

[code lang='c#']

          //get the certificate
            X509Certificate2 theCert = new X509Certificate2();
            theCert.Import("c:\\cert.pfx", "password", X509KeyStorageFlags.Exportable);
            String targetURL = "";
            String ConsumerServiceUrl = "";
            // Create a SAML response object.
            ComponentPro.Saml2.Response samlResponse = new ComponentPro.Saml2.Response();
            // Assign the consumer service url.
            samlResponse.Destination = ConsumerServiceUrl;
            Issuer issuer = new Issuer("");
            samlResponse.Issuer = issuer;
            samlResponse.Status = new Status(SamlPrimaryStatusCode.Success, null);
            Assertion samlAssertion = new Assertion();
            samlAssertion.Issuer = issuer;
            Subject subject = new Subject(new NameId("johnsmith"));
            SubjectConfirmation subjectConfirmation = new SubjectConfirmation(SamlSubjectConfirmationMethod.Bearer);
            SubjectConfirmationData subjectConfirmationData = new SubjectConfirmationData();
            subjectConfirmationData.Recipient = ConsumerServiceUrl;
            subjectConfirmation.SubjectConfirmationData = subjectConfirmationData;
            samlAssertion.Subject = subject;
            //authentication statement
            AuthnStatement authnStatement = new AuthnStatement();
            authnStatement.AuthnContext = new AuthnContext();
            authnStatement.AuthnContext.AuthnContextClassRef = new AuthnContextClassRef(SamlAuthenticateContext.Password);
            //sign the assertion
            // Add assertion to the SAML response object.
            // Create an encrypted SAML assertion from the SAML assertion we have created.
            EncryptedAssertion encryptedSamlAssertion = new EncryptedAssertion(
                new System.Security.Cryptography.Xml.EncryptionMethod(SamlKeyAlgorithm.TripleDesCbc)
            // Add encrypted assertion to the SAML response object.
            // Sign the SAML response with the certificate.
            // Send the SAML response to the service provider.
            samlResponse.SendPostBindingForm(Response.OutputStream, ConsumerServiceUrl, targetURL);


---------------------------------------------------------------------- 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