예제 #1
0
        public static bool PaymentVerify(HttpRequest curRequest, string rootPath, out string merId, out string amt, out string merTransId, out string transId, out string transTime)
        {
            merId      = curRequest.Form["merId"].ToString();
            amt        = curRequest.Form["amt"].ToString();
            merTransId = curRequest.Form["merTransId"].ToString();
            transId    = curRequest.Form["transId"].ToString();
            transTime  = curRequest.Form["transTime"].ToString();
            string        checkValue       = curRequest.Form["checkValue"].ToString();
            string        PaymentPublicKey = File.ReadAllText(rootPath + "\\PaymentPublicKey.txt");
            RSAParameters PubKeyInfo       = RSAUtility.GetPubKeyFromXmlString(PaymentPublicKey);
            string        orgString        = merId + merTransId + amt + transId + transTime;
            ASCIIEncoding byteConverter    = new ASCIIEncoding();

            byte[] orgData               = byteConverter.GetBytes(orgString);
            byte[] signedData            = Convert.FromBase64String(checkValue);
            RSACryptoServiceProvider rsa = new RSACryptoServiceProvider();

            rsa.ImportParameters(PubKeyInfo);
            return(rsa.VerifyData(orgData, signedData, HashAlgorithmName.MD5, RSASignaturePadding.Pkcs1));
        }