From 9c0419eb8d672e5ba77794c7fea5ff26a10a8708 Mon Sep 17 00:00:00 2001 From: ZhaiFanhua Date: Thu, 1 Dec 2022 23:49:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9ADES=E5=8A=A0?= =?UTF-8?q?=E5=AF=86=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Extensions/SecurityEncDecryptExtension.cs | 34 +++++++++---------- ...TagByApiExplorerSettingsOperationFilter.cs | 3 +- 2 files changed, 17 insertions(+), 20 deletions(-) diff --git a/Infrastructure/Extensions/SecurityEncDecryptExtension.cs b/Infrastructure/Extensions/SecurityEncDecryptExtension.cs index 4902b7e..80efa8c 100644 --- a/Infrastructure/Extensions/SecurityEncDecryptExtension.cs +++ b/Infrastructure/Extensions/SecurityEncDecryptExtension.cs @@ -7,14 +7,13 @@ namespace Infrastructure.Extensions { public static class SecurityEncDecryptExtensions { - private static byte[] Keys = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F }; - /// - /// DES加密字符串 - /// - /// 待加密的字符串 - /// 加密密钥,要求为16位 - /// 加密成功返回加密后的字符串,失败返回源串 + /// + /// DES加密字符串 + /// + /// 待加密的字符串 + /// 加密密钥,要求为16位 + /// 加密成功返回加密后的字符串,失败返回源串 public static string EncryptDES(this string encryptString, string encryptKey) { @@ -24,7 +23,7 @@ namespace Infrastructure.Extensions byte[] rgbIV = Keys; byte[] inputByteArray = Encoding.UTF8.GetBytes(encryptString); - using (var DCSP = Aes.Create()) + using (var DCSP = DES.Create()) { using (MemoryStream mStream = new MemoryStream()) { @@ -41,22 +40,21 @@ namespace Infrastructure.Extensions { throw new Exception("密码加密异常" + ex.Message); } - } - /// - /// DES解密字符串 - /// - /// 待解密的字符串 - /// 解密密钥,要求为16位,和加密密钥相同 - /// 解密成功返回解密后的字符串,失败返源串 + /// + /// DES解密字符串 + /// + /// 待解密的字符串 + /// 解密密钥,要求为16位,和加密密钥相同 + /// 解密成功返回解密后的字符串,失败返源串 public static string DecryptDES(this string decryptString, string decryptKey) { byte[] rgbKey = Encoding.UTF8.GetBytes(decryptKey.Substring(0, 16)); byte[] rgbIV = Keys; byte[] inputByteArray = Convert.FromBase64String(decryptString.Replace('_', '+').Replace('~', '/')); - using (var DCSP = Aes.Create()) + using (var DCSP = DES.Create()) { using (MemoryStream mStream = new MemoryStream()) { @@ -69,8 +67,8 @@ namespace Infrastructure.Extensions } } } - } + public static bool TryDecryptDES(this string decryptString, string decryptKey, out string result) { result = ""; @@ -85,4 +83,4 @@ namespace Infrastructure.Extensions } } } -} +} \ No newline at end of file diff --git a/OpenAuth.WebApi/Model/TagByApiExplorerSettingsOperationFilter.cs b/OpenAuth.WebApi/Model/TagByApiExplorerSettingsOperationFilter.cs index f6db838..b29f6da 100644 --- a/OpenAuth.WebApi/Model/TagByApiExplorerSettingsOperationFilter.cs +++ b/OpenAuth.WebApi/Model/TagByApiExplorerSettingsOperationFilter.cs @@ -19,7 +19,7 @@ namespace OpenAuth.WebApi.Model .Cast().FirstOrDefault(); if (apiExplorerSettings != null && !string.IsNullOrWhiteSpace(apiExplorerSettings.GroupName)) { - operation.Tags = new List {new OpenApiTag {Name = apiExplorerSettings.GroupName}}; + operation.Tags = new List { new OpenApiTag { Name = apiExplorerSettings.GroupName } }; } else { @@ -27,7 +27,6 @@ namespace OpenAuth.WebApi.Model {new OpenApiTag {Name = controllerActionDescriptor.ControllerName}}; } } - } } } \ No newline at end of file -- Gitee