Example #1
0
        /// <summary>
        /// Signs the authentication request.
        /// </summary>
        /// <param name="logoutRequest">The authrequest.</param>
        /// <param name="cert">The cert.</param>
        /// <param name="xmlPrivateKey">The XML private key.</param>
        /// <returns></returns>
        public string SignLogoutRequest(string logoutRequest, X509Certificate2 cert, string xmlPrivateKey)
        {
            string result = logoutRequest;

            XmlDocument doc = new XmlDocument();

            doc.LoadXml(result);

            XmlElement signature = SignHelper.SignXmlDocument(doc, cert, xmlPrivateKey);

            doc.DocumentElement.InsertAfter(signature, doc.DocumentElement.ChildNodes[0]);

            string responseStr = doc.OuterXml;


            return(result);
        }
        /// <summary>
        /// Gets the signed authentication request.
        /// </summary>
        /// <param name="cert">The cert.</param>
        /// <param name="privateKey">The private key.</param>
        /// <returns></returns>
        public string GetSignedAuthRequest(X509Certificate2 cert, string xmlPrivateKey)
        {
            string result = GetAuthRequest();

            XmlDocument doc = new XmlDocument();

            doc.LoadXml(result);

            XmlElement signature = SignHelper.SignXmlDocument(doc, cert, xmlPrivateKey);

            doc.DocumentElement.InsertAfter(signature, doc.DocumentElement.ChildNodes[0]);

            result = doc.OuterXml;


            return(result);
        }