File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -83,5 +83,29 @@ public static bool IsBase64String(string keyAsString)
8383 return false ;
8484 }
8585 }
86+
87+ /// <summary>
88+ /// Validates whether the block size is valid for the AES algorithm.
89+ /// </summary>
90+ /// <param name="dataLength">The length of the data to be encrypted.</param>
91+ /// <returns>True if the block size is valid; otherwise, false.</returns>
92+ public static bool IsValidBlockSize ( int dataLength )
93+ {
94+ // AES block size is 128 bits (16 bytes)
95+ return dataLength % 16 == 0 ;
96+ }
97+
98+ /// <summary>
99+ /// Validates whether the byte array is valid for a specific algorithm.
100+ /// </summary>
101+ /// <param name="byteArray">The byte array to validate.</param>
102+ /// <returns>True if the byte array is valid; otherwise, false.</returns>
103+ private static bool IsValidByteArray ( byte [ ] byteArray )
104+ {
105+ // Add your specific validation criteria here
106+ // For example, you might check for non-null, non-empty, or other constraints
107+
108+ return byteArray != null && byteArray . Length > 0 ;
109+ }
86110 }
87111}
You can’t perform that action at this time.
0 commit comments