예제 #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);
        }