/// <summary> /// 生成请求时的签名 /// </summary> /// <param name="sPara">请求给支付宝的参数数组</param> /// <returns>签名结果</returns> private string BuildRequestMysign(Dictionary <string, string> sPara) { //把数组所有元素,按照“参数=参数值”的模式用“&”字符拼接成字符串 string prestr = Core.CreateLinkString(sPara); //把最终的字符串签名,获得签名结果 string mysign = ""; switch (_signType) { case SignType.RSA: mysign = RSAFromPkcs8.Sign(prestr, _privateKey, _inputCharset); break; case SignType.MD5: mysign = AlipayMD5.Sign(prestr, _md5Key, _inputCharset); break; default: mysign = ""; break; } 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; case "RSA": mysign = RSAFromPkcs8.sign(prestr, _private_key, _input_charset); break; case "0001": mysign = RSAFromPkcs8.sign(prestr, _private_key, _input_charset); break; default: mysign = ""; break; } return(mysign); }
/// <summary> /// 生成请求时的签名 /// </summary> /// <param name="sPara">请求给支付宝的参数数组</param> /// <param name="signType">签名方式</param> /// <param name="key">交易安全校验码</param> /// <param name="code">字符编码格式</param> /// <returns>签名结果</returns> private static string BuildRequestMysign(Dictionary <string, string> sPara, string signType, string key, Encoding code) { //把数组所有元素,按照“参数=参数值”的模式用“&”字符拼接成字符串 string prestr = Core.CreateLinkString(sPara); //把最终的字符串签名,获得签名结果 string mysign = ""; switch (signType) { case "MD5": mysign = AlipayMD5.Sign(prestr, key, code); break; default: mysign = ""; break; } return(mysign); }