Skip to content

Commit 03b1c21

Browse files
committed
feat: add validation for DecryptionParameters
1 parent 928f70d commit 03b1c21

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

src/Helpers/Validators.cs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,28 @@ public static void ValidateNotNull(EncryptionParameters parameters)
3737
throw new ArgumentNullException(nameof(parameters.IV), "IV property cannot be null.");
3838
}
3939
}
40+
public static void ValidateNotNull(DecryptionParameters parameters)
41+
{
42+
if (parameters == null)
43+
{
44+
throw new ArgumentNullException(nameof(parameters), "ByteEncryptionParameters instance cannot be null.");
45+
}
46+
47+
if (parameters.DataToDecrypt == null)
48+
{
49+
throw new ArgumentNullException(nameof(parameters.DataToDecrypt), "DataToDecrypt property cannot be null.");
50+
}
51+
52+
if (parameters.SecretKey == null)
53+
{
54+
throw new ArgumentNullException(nameof(parameters.SecretKey), "SecretKey property cannot be null.");
55+
}
56+
57+
if (parameters.IV == null)
58+
{
59+
throw new ArgumentNullException(nameof(parameters.IV), "IV property cannot be null.");
60+
}
61+
}
4062

4163
public static void ValidateNotNull(StringEncryptionParameters parameters)
4264
{

0 commit comments

Comments
 (0)