Esempio n. 1
0
        public static string GetSign(SortedDictionary <string, string> sParaTemp)
        {
            //待签名请求参数数组
            Dictionary <string, string> sPara = new Dictionary <string, string>();
            //签名结果
            string mysign = "";

            //过滤签名参数数组
            sPara = Core.FilterPara(sParaTemp);

            //把数组所有元素,按照“参数=参数值”的模式用“&”字符拼接成字符串
            string prestr = Core.CreateLinkString(sPara);

            //把最终的字符串签名,获得签名结果
            mysign = AlipayMD5.Sign(prestr, Config.Key, Config.Input_charset);

            return(mysign);
        }
        /// <summary>
        /// 生成请求时的签名
        /// </summary>
        /// <param name="sPara">请求给支付宝的参数数组</param>
        /// <returns>签名结果</returns>
        private static string BuildRequestMysign(Dictionary <string, string> sPara)
        {
            //把数组所有元素,按照“参数=参数值”的模式用“&”字符拼接成字符串
            string prestr = Core.CreateLinkString(sPara);

            //把最终的字符串签名,获得签名结果
            string mysign = "";

            switch (_sign_type)
            {
            case "MD5":
                mysign = AlipayMD5.Sign(prestr, _key, _input_charset);
                break;

            default:
                mysign = "";
                break;
            }

            return(mysign);
        }