Ejemplo n.º 1
0
        public static T GetUserLogged <T>(string key) where T : class
        {
            if (Exist(key))
            {
                var httpCookie = HttpContext.Current.Request.Cookies.Get(key);

                if (httpCookie != null)
                {
                    var jsonCookie = CriptografiaSecurity.Decrypt256(Convert.FromBase64String(httpCookie.Value));

                    return(JsonConvert.DeserializeObject <T>(jsonCookie));
                }
            }

            return(null);
        }
Ejemplo n.º 2
0
 public static string EncryptPassword(string value)
 {
     return((!string.IsNullOrWhiteSpace(value)) ? CriptografiaSecurity.EncryptOne(value) : value);
 }
Ejemplo n.º 3
0
 public static string DecryptTwo(string value)
 {
     return(value != null?CriptografiaSecurity.DecryptTwo(value) : null);
 }
Ejemplo n.º 4
0
 public static string EncryptId(string value)
 {
     return((!string.IsNullOrWhiteSpace(value) && value != "0") ? CriptografiaSecurity.EncryptTwo(EncrypAndDecryptSecurity.Encrypt(value)) : "0");
 }
Ejemplo n.º 5
0
 public static string EncryptOne(string value)
 {
     return(value != null?CriptografiaSecurity.EncryptOne(value) : null);
 }