Exemplo n.º 1
0
 public void SetSignValue()
 {
     if (IsSet("sign"))
     {
         throw new WxPayException("已有签名字段!");
     }
     else
     {
         SetValue("nonce_str", WxUntil.GetRandomStr());
         SetValue("sign", WxUntil.MD5Sign(SecretStr(DicToUrl())));
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// MD5加密算法
        /// </summary>
        /// <param name="CompositeString">参数字符串和秘钥字符串拼接而成的字符串</param>
        /// <returns>MD5加密后的字符串</returns>


        public string MakeSign(int signType = 0)
        {
            if (signType == 0)
            {
                return(WxUntil.MD5Sign(SecretStr(DicToUrl())));
            }
            else if (signType == 1)
            {
                return(WxUntil.SHA256(SecretStr(DicToUrl())));
            }
            else
            {
                throw new WxPayException("请输入正确的加密参数!");
            }
        }