示例#1
0
        public static string CreateRSAKeyFile(string generatorPath, string keyDirectory, bool readPubKey = false)
        {
            string text = "success";

            try
            {
                Process process = new Process();
                process.StartInfo = new ProcessStartInfo
                {
                    FileName               = generatorPath,
                    UseShellExecute        = false,
                    RedirectStandardInput  = true,
                    RedirectStandardOutput = true,
                    Arguments              = "\"" + keyDirectory + "\""
                };
                process.Start();
                process.WaitForExit();
            }
            catch (System.Exception ex)
            {
                text = "faild:" + ex.Message.ToString();
            }
            if (text == "success" && readPubKey)
            {
                text = RsaKeyHelper.GetRSAKeyContent(keyDirectory + "/rsa_public_key.pem", true);
            }
            return(text);
        }
        public static void verifyRequestFromAliPay(HttpContext context, string ToUserId, string AppId)
        {
            Dictionary <string, string> param = getAlipayRequstParams(context);
            string local1 = param["biz_content"];

            if (!verifySignAlipayRequest(param))
            {
                ReturnXmlResponse(false, RsaKeyHelper.GetRSAKeyContent(AlipayFuwuConfig.merchant_public_key, true), context, ToUserId, AppId);
            }
            else
            {
                ReturnXmlResponse(true, RsaKeyHelper.GetRSAKeyContent(AlipayFuwuConfig.merchant_public_key, true), context, ToUserId, AppId);
            }
        }
示例#3
0
        public static void verifyRequestFromAliPay(HttpContext context, string ToUserId, string AppId)
        {
            System.Collections.Generic.Dictionary <string, string> alipayRequstParams = AliOHHelper.getAlipayRequstParams(context);
            string text = alipayRequstParams["biz_content"];

            if (!AliOHHelper.verifySignAlipayRequest(alipayRequstParams))
            {
                AliOHHelper.ReturnXmlResponse(false, RsaKeyHelper.GetRSAKeyContent(AlipayFuwuConfig.merchant_public_key, true), context, ToUserId, AppId);
            }
            else
            {
                AliOHHelper.ReturnXmlResponse(true, RsaKeyHelper.GetRSAKeyContent(AlipayFuwuConfig.merchant_public_key, true), context, ToUserId, AppId);
            }
        }
        public static void verifygw(HttpContext context)
        {
            Dictionary <string, string> param = getAlipayRequstParams(context);
            string xml = param["biz_content"];

            if (!verifySignAlipayRequest(param))
            {
                verifygwResponse(false, RsaKeyHelper.GetRSAKeyContent(AlipayFuwuConfig.merchant_public_key, true), context);
            }
            if ("verifygw".Equals(getXmlNode(xml, "EventType")))
            {
                verifygwResponse(true, RsaKeyHelper.GetRSAKeyContent(AlipayFuwuConfig.merchant_public_key, true), context);
            }
        }
示例#5
0
        public static void verifygw(HttpContext context)
        {
            System.Collections.Generic.Dictionary <string, string> alipayRequstParams = AliOHHelper.getAlipayRequstParams(context);
            string xml = alipayRequstParams["biz_content"];

            if (!AliOHHelper.verifySignAlipayRequest(alipayRequstParams))
            {
                AliOHHelper.verifygwResponse(false, RsaKeyHelper.GetRSAKeyContent(AlipayFuwuConfig.merchant_public_key, true), context);
            }
            if ("verifygw".Equals(AliOHHelper.getXmlNode(xml, "EventType")))
            {
                AliOHHelper.verifygwResponse(true, RsaKeyHelper.GetRSAKeyContent(AlipayFuwuConfig.merchant_public_key, true), context);
            }
        }