Skip to content

Commit e8b4781

Browse files
committed
Add NullCheck method without Iv as params
1 parent 8365ab8 commit e8b4781

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

Encrypt/AesEncryption/Encrypt.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public byte[] AesEncrypt(string data, string secretKey, string iv)
1818
var aesData = data.HexadecimalStringToByteArray();
1919

2020
return EncryptAES(aesData, aesKey, aesIv);
21-
}
21+
}
2222

2323
public string AesEncryptByteToHexString(byte[] data, byte[] secretKey, byte[] iv)
2424
{
@@ -53,6 +53,15 @@ private void NullChecks(string data, string secretKey, string iv)
5353
throw new ArgumentNullException("IV");
5454
}
5555

56+
private void NullChecks(string data, string secretKey)
57+
{
58+
if (data == null || data.Length <= 0)
59+
throw new ArgumentNullException("plainText");
60+
61+
if (secretKey == null || secretKey.Length <= 0)
62+
throw new ArgumentNullException("Key");
63+
}
64+
5665
//public byte[] AesEncrypt(byte[] data, byte[] key, byte[] iv, ReturnType returnType)
5766
//{
5867

0 commit comments

Comments
 (0)