From f197ec7ff535871ed6cfcdf6d523d4d3b69d9f70 Mon Sep 17 00:00:00 2001
From: falcon <9504402@qq.com>
Date: Tue, 6 Sep 2022 13:54:40 +0800
Subject: [PATCH] =?UTF-8?q?AES=E9=85=8D=E7=BD=AE=E5=A2=9E=E5=8A=A0?=
=?UTF-8?q?=E7=A7=98=E9=92=A5=E5=AD=97=E7=AC=A6=E8=A1=A8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Falcon.SugarApi/Encryption/AESConfig.cs | 5 +++++
Falcon.SugarApi/Encryption/AESProvider.cs | 2 +-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/Falcon.SugarApi/Encryption/AESConfig.cs b/Falcon.SugarApi/Encryption/AESConfig.cs
index 30ecb6e..1e9627b 100644
--- a/Falcon.SugarApi/Encryption/AESConfig.cs
+++ b/Falcon.SugarApi/Encryption/AESConfig.cs
@@ -11,5 +11,10 @@
/// 秘钥长度。最大32
///
public int KeyLength { get => keyLength; set => keyLength = value > 32 ? 32 : value; }
+
+ ///
+ /// 秘钥字符表
+ ///
+ public string KeyChars { get; set; } = @"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ123456789,.!/*\";
}
}
diff --git a/Falcon.SugarApi/Encryption/AESProvider.cs b/Falcon.SugarApi/Encryption/AESProvider.cs
index 47dc7e9..082eb30 100644
--- a/Falcon.SugarApi/Encryption/AESProvider.cs
+++ b/Falcon.SugarApi/Encryption/AESProvider.cs
@@ -73,7 +73,7 @@ namespace Falcon.SugarApi.Encryption
///
public string GenerateKey() {
- var chars = @"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ123456789,.!/*\";
+ var chars = this.Config.KeyChars;
var r = new Random();
var len = this.Config.KeyLength;
var sb = new StringBuilder(len);