예제 #1
0
        public static bool CheckOrderSign(dynamic obj, ILogger log)
        {
            Dictionary <string, string> dict = new Dictionary <string, string>();

            dict.Add("userlogin", obj.userlogin + "");
            dict.Add("detailurl", obj.detailurl + "");
            dict.Add("cardtype", obj.cardtype + "");
            dict.Add("payway", obj.payway + "");
            dict.Add("prodname", obj.prodname + "");
            dict.Add("notifyurl", obj.notifyurl + "");
            dict.Add("mobile", obj.mobile + "");
            dict.Add("account", obj.account + "");
            dict.Add("productid", obj.productid + "");
            dict.Add("money", obj.money + "");
            dict.Add("price", obj.price + "");
            dict.Add("couponprice", obj.couponprice + "");
            dict.Add("couponid", obj.couponid + "");
            dict.Add("couponch", obj.couponch + "");
            dict.Add("ordertime", obj.ordertime + "");
            dict.Add("userip", obj.userip + "");

            string origin_str = CreateSignStr(dict);

            if (!SecurityCore.VerifyFromBase64(origin_str, pub_key, obj.sign, "SHA256withRSA", "utf-8"))
            {
                log.Info(string.Format("签名失败,签名原串:{0}", origin_str));
                return(false);
            }
            return(true);
        }
예제 #2
0
        public static bool CheckRefundSign(dynamic obj, ILogger log)
        {
            Dictionary <string, string> dict = new Dictionary <string, string>();

            dict.Add("detailurl", obj.detailurl + "");
            dict.Add("orderid", obj.orderid + "");
            dict.Add("mobile", obj.mobile + "");
            dict.Add("price", obj.price + "");

            string origin_str = CreateSignStr(dict);

            if (!SecurityCore.VerifyFromBase64(origin_str, pub_key, obj.sign, "SHA256withRSA", "utf-8"))
            {
                log.Info(string.Format("签名失败,签名原串:{0}", origin_str));
                return(false);
            }
            return(true);
        }