System Library Common Framework
Search Results for

    *.Benchmark*,*.Tests*,*.ApiTests*,*.BaseTest*,DelegateJsonConverter,CalleeCancelledRequestException,ClientResponse,ContentType,OutputCachePolicy
    Show / Hide Table of Contents Show / Hide Table of Contents
    NamespaceSystemLibrary.Common.Framework.Attributes SystemLibrary.Common.Framework.Json.dll

    Encrypt and decrypt a String, Long or Int property or field on serialization and deserialization

    Useful when you want to hide productId's or similar in Frontend part of your application. Avoids having int's or ID's in the frontend, for attackers wanting to brute force endpoints taking INTs

    Remarks
    X

    Does not support all property/field types, but at least supports: int, int16, uint, int64, uint64 and string types

    JsonEncryptAttribute

    [AttributeUsage(AttributeTargets.Property|AttributeTargets.Field)] public class JsonEncryptAttribute : JsonConverterAttribute

    Inheritance
    object
    Attribute
    JsonAttribute
    JsonConverterAttribute
    JsonEncryptAttribute
    Inherited Members
    JsonConverterAttribute.ConverterType
    Examples
    X

    Model.cs:

    class Model
    {
        // Value is encrypted upon serialization (stringify) and decrypted on deserialization (objectify)
        [JsonEncrypt]
        public string Token {get;set;} 
        [JsonEncrypt]
        public string ProductId {get;set;}
    }
    Arguments
    X

    Constructors

    Encrypt and decrypt a String, Long or Int property or field on serialization and deserialization

    Useful when you want to hide productId's or similar in Frontend part of your application. Avoids having int's or ID's in the frontend, for attackers wanting to brute force endpoints taking INTs

    Remarks
    X

    Does not support all property/field types, but at least supports: int, int16, uint, int64, uint64 and string types

    public JsonEncryptAttribute(string key = null, string IV = null, bool addedIV = true)

    X

    Model.cs:

    class Model
    {
        // Value is encrypted upon serialization (stringify) and decrypted on deserialization (objectify)
        [JsonEncrypt]
        public string Token {get;set;} 
        [JsonEncrypt]
        public string ProductId {get;set;}
    }
    X
    Methods arguments
    Type Name Description
    string key
    string IV
    bool addedIV

    Methods

    When overridden in a derived class and ConverterType is null, allows the derived class to create a JsonConverter in order to pass additional state.

    Remarks
    X

    Does not support all property/field types, but at least supports: int, int16, uint, int64, uint64 and string types

    public override JsonConverter CreateConverter(Type typeToConvert)

    X
    Methods arguments
    Type Name Description
    Type typeToConvert

    The type of the converter.

    X
    Type Description
    JsonConverter

    The custom converter.

    Overrides
    JsonConverterAttribute.CreateConverter(Type)

    Extension Methods

    ObjectExtensions.Json(object, bool)
    ObjectExtensions.Json(object, JsonSerializerOptions, bool, params JsonConverter[])
    ObjectExtensions.Json(object, params JsonConverter[])
    ObjectExtensions.Xml(object)

    }

    In This Article
    Package: nuget
    Source: github
    Website: System Library Common Framework