NullReferenceException
This commit is contained in:
@ -189,7 +189,7 @@ internal abstract class Person
|
||||
_ = Directory.CreateDirectory(directory);
|
||||
string? rootDirectoryParent = Path.GetDirectoryName(storage.RootDirectory);
|
||||
if (string.IsNullOrEmpty(rootDirectoryParent))
|
||||
throw new ArgumentNullException(nameof(rootDirectoryParent));
|
||||
throw new NullReferenceException(nameof(rootDirectoryParent));
|
||||
if (!Directory.Exists(rootDirectoryParent))
|
||||
localKnownPeopleFile = string.Empty;
|
||||
else
|
||||
|
@ -25,7 +25,7 @@ public static class RijndaelEncryption
|
||||
{
|
||||
string result;
|
||||
if (string.IsNullOrEmpty(text))
|
||||
throw new ArgumentNullException(nameof(text));
|
||||
throw new NullReferenceException(nameof(text));
|
||||
RijndaelManaged aesAlg = NewRijndaelManaged(salt);
|
||||
ICryptoTransform encryptor = aesAlg.CreateEncryptor(aesAlg.Key, aesAlg.IV);
|
||||
MemoryStream msEncrypt = new();
|
||||
@ -58,7 +58,7 @@ public static class RijndaelEncryption
|
||||
public static string Decrypt(string cipherText, string salt)
|
||||
{
|
||||
if (string.IsNullOrEmpty(cipherText))
|
||||
throw new ArgumentNullException(nameof(cipherText));
|
||||
throw new NullReferenceException(nameof(cipherText));
|
||||
if (!IsBase64String(cipherText))
|
||||
throw new Exception("The cipherText input parameter is not base64 encoded");
|
||||
string text;
|
||||
@ -82,7 +82,7 @@ public static class RijndaelEncryption
|
||||
private static RijndaelManaged NewRijndaelManaged(string salt)
|
||||
{
|
||||
if (salt == null)
|
||||
throw new ArgumentNullException(nameof(salt));
|
||||
throw new NullReferenceException(nameof(salt));
|
||||
byte[] saltBytes = Encoding.ASCII.GetBytes(salt);
|
||||
Rfc2898DeriveBytes key = new(_Inputkey, saltBytes);
|
||||
RijndaelManaged aesAlg = new();
|
||||
|
Reference in New Issue
Block a user