Skip to content

Commit cf2bd20

Browse files
committed
Update AES default keySize=256
1 parent 120bbcb commit cf2bd20

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/NETCore.Encrypt/EncryptProvider.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ private static string GetRandomStr(int length)
4343

4444
#region AES
4545

46+
/*
47+
AES:16位密钥=128位,24位密钥=192位,32位密钥=256位,IV均为16位
48+
*/
49+
4650
/// <summary>
4751
/// Create ase key
4852
/// </summary>
@@ -239,7 +243,7 @@ public static string AESEncrypt(string data, string key)
239243

240244
aes.Mode = CipherMode.ECB;
241245
aes.Padding = PaddingMode.PKCS7;
242-
aes.KeySize = 128;
246+
aes.KeySize = 256;
243247
aes.Key = bKey;
244248

245249
using (CryptoStream cryptoStream = new CryptoStream(Memory, aes.CreateEncryptor(), CryptoStreamMode.Write))
@@ -281,7 +285,7 @@ public static string AESDecrypt(string data, string key)
281285
{
282286
aes.Mode = CipherMode.ECB;
283287
aes.Padding = PaddingMode.PKCS7;
284-
aes.KeySize = 128;
288+
aes.KeySize = 256;
285289
aes.Key = bKey;
286290

287291
using (CryptoStream cryptoStream = new CryptoStream(Memory, aes.CreateDecryptor(), CryptoStreamMode.Read))

0 commit comments

Comments
 (0)