public static string GetRequestXmlString(Stream xmlStream, IEncodingKeyProvider encodingKeyProvider)
        {
            if (xmlStream == null || xmlStream.Length == 0)
            {
                return(null);
            }
            XmlDocument doc = new XmlDocument();

            doc.Load(xmlStream);
            XmlNode firstNode = doc.FirstChild;

            if (firstNode == null)
            {
                return(null);
            }
            //if (encodingKeyProvider != null)
            //{
            //    encodingKeyProvider.InitFromXmlNode(firstNode);
            //}
            var encryptXml = firstNode.GetInnerXml("Encrypt");

            if (encryptXml != null)
            {
                return(encodingKeyProvider.Decrypt(encryptXml));
            }
            return(doc.InnerXml);
        }
        static RequestMessageBase GetEncodingInstance(string context, IEncodingKeyProvider encodingKeyProvider)
        {
            if (encodingKeyProvider == null)
            {
                return(null);
            }
            string xml = encodingKeyProvider.Decrypt(context);

            if (xml == null)
            {
            }
            XmlDocument doc = new XmlDocument();

            doc.LoadXml(xml);
            //return GetEncodingInstance(doc, encodingKeyProvider);
            return(GetInstance(doc, encodingKeyProvider, true));
        }