AES配置增加秘钥字符表
This commit is contained in:
parent
5ed2a9997a
commit
f197ec7ff5
|
@ -11,5 +11,10 @@
|
||||||
/// 秘钥长度。最大32
|
/// 秘钥长度。最大32
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int KeyLength { get => keyLength; set => keyLength = value > 32 ? 32 : value; }
|
public int KeyLength { get => keyLength; set => keyLength = value > 32 ? 32 : value; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 秘钥字符表
|
||||||
|
/// </summary>
|
||||||
|
public string KeyChars { get; set; } = @"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ123456789,.!/*\";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,7 +73,7 @@ namespace Falcon.SugarApi.Encryption
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public string GenerateKey() {
|
public string GenerateKey() {
|
||||||
var chars = @"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ123456789,.!/*\";
|
var chars = this.Config.KeyChars;
|
||||||
var r = new Random();
|
var r = new Random();
|
||||||
var len = this.Config.KeyLength;
|
var len = this.Config.KeyLength;
|
||||||
var sb = new StringBuilder(len);
|
var sb = new StringBuilder(len);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user