Exemple #1
0
        public override string ReadJson(JsonReader reader, Type objectType, string existingValue, bool hasExistingValue, JsonSerializer serializer)
        {
            var result = string.Empty;

            try
            {
                var val = StringCrypt.DecryptString((string)reader.Value, _cryptPass);

                if (!string.IsNullOrWhiteSpace(val) && val.StartsWith(_cryptCheck))
                {
                    result = val.Replace(_cryptCheck, string.Empty);
                }
            }
            catch (Exception e)
            {
                Log.O("Error decrypting string: {0}", e);
            }

            return(result);
        }