using System;
using System.Buffers.Text;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
namespace IoTIntegrationPlatform.Common
{
///
/// 加解密公共类
///
public static class EncryptHelper
{
//private readonly static string key = "DD57F2D5CAA11BDC";
///
/// AES64位加密
///
///
///
public static string AESEncrypt(string content,string key)
{
string result = string.Empty;
try
{
byte[] bytes = AESHelper.Encrypt(content, key);
result = Convert.ToBase64String(bytes);
}
catch (Exception ex)
{
Logging.Error(ex, ex.Message);
}
return result;
}
///
/// AES64位解密
///
///
public static string AESDecryption(string content, string key)
{
string result = string.Empty;
try
{
byte[] bytes = Convert.FromBase64String(content);
result = Encoding.Default.GetString(AESHelper.Decrypt(bytes, key));
}
catch (Exception ex)
{
Logging.Error(ex, ex.Message);
}
return result;
}
}
}