public bool UnsignMD5WithRSA(string strSignData, string strSource, string strPublicKeyPath)
        {
            XmlDocument xmlDocument = new XmlDocument();

            xmlDocument.Load(strPublicKeyPath);
            XmlNodeList elementsByTagName = xmlDocument.GetElementsByTagName("RSAKeyValue");

            elementsByTagName.Item(0).SelectSingleNode("Modulus").InnerText  = Convert.ToBase64String(this.GetBytes(elementsByTagName.Item(0).SelectSingleNode("Modulus").InnerText.Trim()));
            elementsByTagName.Item(0).SelectSingleNode("Exponent").InnerText = Convert.ToBase64String(this.GetBytes(elementsByTagName.Item(0).SelectSingleNode("Exponent").InnerText.Trim()));
            string      innerXml    = xmlDocument.InnerXml;
            RSACryption rSACryption = new RSACryption();
            string      p_strHashbyteDeformatter = "";

            rSACryption.GetHash(strSource, ref p_strHashbyteDeformatter);
            return(rSACryption.SignatureDeformatter(innerXml, p_strHashbyteDeformatter, strSignData));
        }
Esempio n. 2
0
        public bool UnsignMD5WithRSA(string strSignData, string strSource, string strPublicKeyPath)
        {
            XmlDocument document = new XmlDocument();

            document.Load(strPublicKeyPath);
            XmlNodeList elementsByTagName = document.GetElementsByTagName("RSAKeyValue");

            elementsByTagName[0].SelectSingleNode("Modulus").InnerText  = Convert.ToBase64String(this.GetBytes(elementsByTagName[0].SelectSingleNode("Modulus").InnerText.Trim()));
            elementsByTagName[0].SelectSingleNode("Exponent").InnerText = Convert.ToBase64String(this.GetBytes(elementsByTagName[0].SelectSingleNode("Exponent").InnerText.Trim()));
            string      innerXml    = document.InnerXml;
            RSACryption cryption    = new RSACryption();
            string      strHashData = "";

            cryption.GetHash(strSource, ref strHashData);
            if (!cryption.SignatureDeformatter(innerXml, strHashData, strSignData))
            {
                return(false);
            }
            return(true);
        }