using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Tango.Core.Cryptography; using Tango.FSE.BL; namespace Tango.FSE.UI.Cryptography { public class DefaultCryptographyProvider : ICryptographyProvider { private ICryptographer _cryptographer; public DefaultCryptographyProvider() { _cryptographer = new MachineLevelCryptographer(); } public string Encrypt(string text) { return _cryptographer.Encrypt(text); } public string Decrypt(string encryptedText) { return _cryptographer.Decrypt(encryptedText); } public string Encrypt(object obj) { return Encrypt(JsonConvert.SerializeObject(obj)); } public T Decrypt(string encryptedText) { return JsonConvert.DeserializeObject(Decrypt(encryptedText)); } } }