|
@@ -22,6 +22,8 @@ namespace OASystem.Domain.AesEncryption
|
|
|
/// <returns></returns>
|
|
|
public static string Encrypt(string plainText)
|
|
|
{
|
|
|
+ if (string.IsNullOrEmpty(plainText)) return plainText;
|
|
|
+ if (!EncryptionProcessor.IsEncrypted(plainText)) return plainText;
|
|
|
using var aes = Aes.Create();
|
|
|
aes.Key = Encoding.UTF8.GetBytes(Key);
|
|
|
aes.IV = Encoding.UTF8.GetBytes(IV);
|
|
@@ -38,6 +40,9 @@ namespace OASystem.Domain.AesEncryption
|
|
|
/// <returns></returns>
|
|
|
public static string Decrypt(string cipherText)
|
|
|
{
|
|
|
+ if (string.IsNullOrEmpty(cipherText)) return cipherText;
|
|
|
+ if (!EncryptionProcessor.IsEncrypted(cipherText)) return cipherText;
|
|
|
+
|
|
|
using var aes = Aes.Create();
|
|
|
aes.Key = Encoding.UTF8.GetBytes(Key);
|
|
|
aes.IV = Encoding.UTF8.GetBytes(IV);
|