fix: use proper exception type
This commit is contained in:
+2
-2
@@ -8,7 +8,7 @@ internal sealed class StaticKeyProvider : IEncryptionKeyProvider
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(base64Key))
|
||||
{
|
||||
throw new ArgumentNullException(nameof(base64Key));
|
||||
throw new ArgumentException("Cannot be null or whitespace.", nameof(base64Key));
|
||||
}
|
||||
|
||||
byte[] decodedKey;
|
||||
@@ -22,7 +22,7 @@ internal sealed class StaticKeyProvider : IEncryptionKeyProvider
|
||||
throw new ArgumentException("The provided key is not a valid Base64 string.", nameof(base64Key), ex);
|
||||
}
|
||||
|
||||
if (decodedKey.Length != 32)
|
||||
if (decodedKey.Length is not 32)
|
||||
{
|
||||
throw new ArgumentException("The encryption key must be exactly 32 bytes (256 bits) for AES-256 encryption.", nameof(base64Key));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user