File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ using SafeCrypt . src . Encryption . AesEncryption . Models ;
2+ using System ;
3+ using System . Collections . Generic ;
4+ using System . Text ;
5+
6+ namespace SafeCrypt . src . Helpers
7+ {
8+ public static class Validators
9+ {
10+ /// <summary>
11+ /// Validates that the specified ByteEncryptionParameters instance is not null
12+ /// and that its required properties (Data, SecretKey, IV) are not null.
13+ /// </summary>
14+ /// <param name="parameters">The ByteEncryptionParameters instance to validate.</param>
15+ /// <exception cref="ArgumentNullException">
16+ /// Thrown if the specified parameters instance is null or if any of its required properties are null.
17+ /// </exception>
18+ public static void ValidateNotNull ( ByteEncryptionParameters parameters )
19+ {
20+ if ( parameters == null )
21+ {
22+ throw new ArgumentNullException ( nameof ( parameters ) , "ByteEncryptionParameters instance cannot be null." ) ;
23+ }
24+
25+ if ( parameters . Data == null )
26+ {
27+ throw new ArgumentNullException ( nameof ( parameters . Data ) , "Data property cannot be null." ) ;
28+ }
29+
30+ if ( parameters . SecretKey == null )
31+ {
32+ throw new ArgumentNullException ( nameof ( parameters . SecretKey ) , "SecretKey property cannot be null." ) ;
33+ }
34+
35+ if ( parameters . IV == null )
36+ {
37+ throw new ArgumentNullException ( nameof ( parameters . IV ) , "IV property cannot be null." ) ;
38+ }
39+ }
40+ }
41+ }
You can’t perform that action at this time.
0 commit comments