try decrypt

This commit is contained in:
2020-11-26 12:01:28 +01:00
parent 22ab6275a0
commit e833e48421

View File

@@ -65,7 +65,14 @@ namespace Pilz.Cryptography
public string Decrypt(string encryptedValue)
{
return DecryptStringFromBytes_Aes(Convert.FromBase64String(encryptedValue), GetKey(), GetIV());
try
{
return DecryptStringFromBytes_Aes(Convert.FromBase64String(encryptedValue), GetKey(), GetIV());
}
catch (CryptographicException)
{
return string.Empty;
}
}
public static string Decrypt(string encryptedValue, string key, string iv)
@@ -76,7 +83,14 @@ namespace Pilz.Cryptography
public string Encrypt(string plainValue)
{
return Convert.ToBase64String(EncryptStringToBytes_Aes(plainValue, GetKey(), GetIV()));
try
{
return Convert.ToBase64String(EncryptStringToBytes_Aes(plainValue, GetKey(), GetIV()));
}
catch (CryptographicException)
{
return string.Empty;
}
}
public static string Encrypt(string plainValue, string key, string iv)