Пример #1
0
        public static object ObjectFromEncryptedJSON(string data)
        {
            WalletEncryptionV2 enc     = new WalletEncryptionV2();
            string             secured = enc.Decrypt(data);

            return(Newtonsoft.Json.JsonConvert.DeserializeObject(secured));
        }
Пример #2
0
        public static T ObjectFromEncryptedJSON <T>(string data)
        {
            WalletEncryptionV2 enc = new WalletEncryptionV2();

            try
            {
                string secured = enc.Decrypt(data);
                return(Newtonsoft.Json.JsonConvert.DeserializeObject <T>(secured));
            }
            catch (Exception ex)
            {
                ex.ToString();
            }
            return(default(T));
        }
Пример #3
0
        public static string ObjectToEncryptedJSON(object obj)
        {
            string ret = Newtonsoft.Json.JsonConvert.SerializeObject(obj);

            WalletEncryptionV2 enc     = new WalletEncryptionV2();
            string             secured = "";

            if (!string.IsNullOrEmpty(ret))
            {
                try
                {
                    secured = enc.encrypt(ret);
                }
                catch (Exception ex)
                {
                    ex.ToString();
                }
            }

            return(secured);
        }