下单加签
AopUtils.SignAopRequest(sortedTxtParams,应用私钥, "UTF-8", false, "RSA2");
异步回调(这里一直验签失败,什么原因,是不是我用错方法了)问题已解决(检查支付宝公钥,验签使用AlipaySignature.RSACheckContent方法)
bool checkSign = AlipaySignature.RSACheckV2(txtParams, 支付宝公钥, "UTF-8", "RSA2", false);
如下情况测试是可通过的
[TestMethod] public void TestSign() { IDictionary<string, string> paramsMap = new Dictionary<string, string>(); paramsMap.Add("app_id", "2018052161078888"); //签名 string sign = AlipaySignature.RSASign(paramsMap, 应用私钥, "utf-8", false, "RSA2"); paramsMap.Add("sign", sign); //验证签名 bool checkSign = AlipaySignature.RSACheckV2(paramsMap, 应用公钥, "utf-8", "RSA2", false); Assert.IsTrue(checkSign); }