Пример #1
0
 public static string RSASignContent(string data, string privateKey, string signType)
 {
     return(signType switch
     {
         "RSA1" => SHA1WithRSA.Sign(data, privateKey),
         "RSA2" => SHA256WithRSA.Sign(data, privateKey),
         _ => SHA1WithRSA.Sign(data, privateKey),
     });
Пример #2
0
        public static string RSASignContent(string data, string privateKey, string signType)
        {
            var key = RSAUtilities.GetRSAParametersFormRsaPrivateKey(privateKey);

            switch (signType)
            {
            case "RSA2":
                return(SHA256WithRSA.Sign(data, key));

            default:
                return(SHA1WithRSA.Sign(data, key));
            }
        }
Пример #3
0
        public static string RSASignContent(string data, string privateKey, string signType)
        {
            switch (signType)
            {
            case "RSA1":
                return(SHA1WithRSA.Sign(data, privateKey));

            case "RSA2":
                return(SHA256WithRSA.Sign(data, privateKey));

            default:
                return(SHA1WithRSA.Sign(data, privateKey));
            }
        }
Пример #4
0
        public void PrimaryHandler(WeChatPayOptions options, WeChatPayDictionary sortedTxtParams)
        {
            if (!string.IsNullOrEmpty(options.SubAppId))
            {
                sortedTxtParams.Add(WeChatPayConsts.appId, options.SubAppId);
            }
            else
            {
                sortedTxtParams.Add(WeChatPayConsts.appId, options.AppId);
            }

            sortedTxtParams.Add(WeChatPayConsts.timeStamp, WeChatPayUtility.GetTimeStamp());
            sortedTxtParams.Add(WeChatPayConsts.nonceStr, WeChatPayUtility.GenerateNonceStr());
            sortedTxtParams.Add(WeChatPayConsts.signType, WeChatPayConsts.RSA);

            var signatureSourceData = BuildSignatureSourceData(sortedTxtParams);

            sortedTxtParams.Add(WeChatPayConsts.paySign, SHA256WithRSA.Sign(options.CertificateRSAPrivateKey, signatureSourceData));
        }