|
|
@ -1,4 +1,4 @@
|
|
|
|
using Microsoft.Extensions.Configuration;
|
|
|
|
using Microsoft.Extensions.Configuration;
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
using Microsoft.Extensions.Logging;
|
|
|
|
using System;
|
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Collections.Generic;
|
|
|
@ -36,9 +36,9 @@ namespace Infrastructure.Sms
|
|
|
|
{
|
|
|
|
{
|
|
|
|
try
|
|
|
|
try
|
|
|
|
{
|
|
|
|
{
|
|
|
|
#pragma warning disable CA2000 // 丢失范围之前释放对象
|
|
|
|
#pragma warning disable CA2000 // 丢失范围之前释放对象
|
|
|
|
var client = this._httpClientFactory.CreateClient();
|
|
|
|
var client = this._httpClientFactory.CreateClient();
|
|
|
|
#pragma warning restore CA2000 // 丢失范围之前释放对象
|
|
|
|
#pragma warning restore CA2000 // 丢失范围之前释放对象
|
|
|
|
var formData = new List<KeyValuePair<string, string>>
|
|
|
|
var formData = new List<KeyValuePair<string, string>>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
new KeyValuePair<string, string>("AppKey", this._appKey),
|
|
|
|
new KeyValuePair<string, string>("AppKey", this._appKey),
|
|
|
@ -48,9 +48,9 @@ namespace Infrastructure.Sms
|
|
|
|
formData.Add(new KeyValuePair<string, string>("CurTime", seconds));
|
|
|
|
formData.Add(new KeyValuePair<string, string>("CurTime", seconds));
|
|
|
|
var sumValue = string.Format(CultureInfo.InvariantCulture, "{0}{1}{2}", this._appSecret, formData[1].Value, formData[2].Value);
|
|
|
|
var sumValue = string.Format(CultureInfo.InvariantCulture, "{0}{1}{2}", this._appSecret, formData[1].Value, formData[2].Value);
|
|
|
|
var sumBytes = Encoding.UTF8.GetBytes(sumValue);
|
|
|
|
var sumBytes = Encoding.UTF8.GetBytes(sumValue);
|
|
|
|
#pragma warning disable CA5350 // 不要使用弱加密算法
|
|
|
|
#pragma warning disable CA5350 // 不要使用弱加密算法
|
|
|
|
using var sha1 = SHA1.Create();
|
|
|
|
using var sha1 = SHA1.Create();
|
|
|
|
#pragma warning restore CA5350 // 不要使用弱加密算法
|
|
|
|
#pragma warning restore CA5350 // 不要使用弱加密算法
|
|
|
|
var sumHash = sha1.ComputeHash(sumBytes);
|
|
|
|
var sumHash = sha1.ComputeHash(sumBytes);
|
|
|
|
var hashValue = string.Empty;
|
|
|
|
var hashValue = string.Empty;
|
|
|
|
var builder = new StringBuilder();
|
|
|
|
var builder = new StringBuilder();
|
|
|
|