• API Overview
  • EBICS API
  • FinTS API
  • XS2A API
  • SEPA API
Search Results for

    Class JsonJwt

    Represents a JSON Web Token (JWT).

    Inheritance
    System.Object
    JsonJwt
    Inherited Members
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.ToString()
    Namespace: Subsembly.Json
    Assembly: Subsembly.Json.dll
    Syntax
    public class JsonJwt
    Remarks

    Supports creating, parsing and validating JWT tokens.

    Constructors

    JsonJwt()

    Declaration
    public JsonJwt()

    JsonJwt(JsonObject)

    Declaration
    public JsonJwt(JsonObject jsPayload)
    Parameters
    Type Name Description
    JsonObject jsPayload

    Properties

    Algorithm

    Declaration
    public string Algorithm { get; }
    Property Value
    Type Description
    System.String

    Audience

    Either a single case-sensitive string or URI or an array of such values that uniquely identify the intended recipients of this JWT.In other words, when this claim is present, the party reading the data in this JWT must find itself in the aud claim or disregard the data contained in the JWT. As in the case of the iss and sub claims, this claim is application specific.

    Declaration
    public string Audience { get; set; }
    Property Value
    Type Description
    System.String

    AuthorizedParty

    A case-sensitive string that identifies the party to which the ID Token was issued.

    Declaration
    public string AuthorizedParty { get; set; }
    Property Value
    Type Description
    System.String

    Expiration

    The value of the expiration time claim from the Payload.

    Declaration
    public DateTime Expiration { get; set; }
    Property Value
    Type Description
    System.DateTime
    Remarks

    If there is no Payload, or it does not contain an exp field, then this property returns DateTime.MaxValue.

    Identifier

    A string representing a unique identifier for this JWT. This claim may be used to differentiate JWTs with other similar content(preventing replays, for instance). It is up to the implementation to guarantee uniqueness.

    Declaration
    public string Identifier { get; set; }
    Property Value
    Type Description
    System.String

    IssuedAt

    The value of the "issued at" time claim from the Payload.

    Declaration
    public DateTime IssuedAt { get; set; }
    Property Value
    Type Description
    System.DateTime
    Remarks

    If there is no Payload, or it does not contain an iat field, then this property returns DateTime.MinValue.

    Issuer

    A case-sensitive string or URI that uniquely identifies the party that issued the JWT.Its interpretation is application specific (there is no central authority managing issuers).

    Declaration
    public string Issuer { get; set; }
    Property Value
    Type Description
    System.String

    NotBefore

    The value of the "not before" time claim from the Payload.

    Declaration
    public DateTime NotBefore { get; set; }
    Property Value
    Type Description
    System.DateTime
    Remarks

    If there is no Payload, or it does not contain an nbf field, then this property returns DateTime.MinValue.

    Payload

    Declaration
    public JsonObject Payload { get; set; }
    Property Value
    Type Description
    JsonObject

    Subject

    A case-sensitive string or URI that uniquely identifies the party that this JWT carries information about. In other words, the claims contained in this JWT are statements about this party.The JWT spec specifies that this claim must be unique in the context of the issuer or, in cases where that is not possible, globally unique. Handling of this claim is application specific.

    Declaration
    public string Subject { get; set; }
    Property Value
    Type Description
    System.String

    Methods

    CreateHS256(Byte[])

    Creates a token with the current Payload with a HS256 signature.

    Declaration
    public string CreateHS256(byte[] vbKey)
    Parameters
    Type Name Description
    System.Byte[] vbKey
    Returns
    Type Description
    System.String

    CreateHS256(String)

    Creates a token with the current Payload with a HS256 signature.

    Declaration
    public string CreateHS256(string sSecret)
    Parameters
    Type Name Description
    System.String sSecret
    Returns
    Type Description
    System.String

    CreateRS256(CryRSA)

    Creates a token with the current Payload with a RS256 signature.

    Declaration
    public string CreateRS256(CryRSA aPrivateKey)
    Parameters
    Type Name Description
    Subsembly.Crypto.CryRSA aPrivateKey
    Returns
    Type Description
    System.String

    CreateUnsecured()

    Creates an unsecured token carrying Payload without signature.

    Declaration
    public string CreateUnsecured()
    Returns
    Type Description
    System.String

    GetClaim(String)

    Declaration
    public JsonValue GetClaim(string sFieldName)
    Parameters
    Type Name Description
    System.String sFieldName
    Returns
    Type Description
    JsonValue

    IsNowValid()

    Indicates whether this JWT is now valid, accoring to its NotBefore and Expiration claims.

    Declaration
    public bool IsNowValid()
    Returns
    Type Description
    System.Boolean

    ParseToken(String)

    Parses the token, but does not validate it's signature, yet.

    Declaration
    public static JsonJwt ParseToken(string sToken)
    Parameters
    Type Name Description
    System.String sToken
    Returns
    Type Description
    JsonJwt
    Exceptions
    Type Condition
    JsonJwtException

    Thrown, if the given token is invalid.

    System.ArgumentNullException

    The parameter sToken was null.

    SetClaim(String, JsonValue)

    Declaration
    public void SetClaim(string sFieldName, JsonValue aFieldValue)
    Parameters
    Type Name Description
    System.String sFieldName
    JsonValue aFieldValue

    VerifyHS256(Byte[])

    Declaration
    public bool VerifyHS256(byte[] vbKey)
    Parameters
    Type Name Description
    System.Byte[] vbKey
    Returns
    Type Description
    System.Boolean
    Exceptions
    Type Condition
    System.ArgumentNullException

    The parameter vbKey was null.

    System.InvalidOperationException

    This token was not fully created or parsed, yet.

    VerifyHS256(String)

    Declaration
    public bool VerifyHS256(string sSecret)
    Parameters
    Type Name Description
    System.String sSecret
    Returns
    Type Description
    System.Boolean
    Exceptions
    Type Condition
    System.ArgumentNullException

    The parameter sSecret was null.

    VerifyRS256(CryRSA)

    Declaration
    public bool VerifyRS256(CryRSA aPublicKey)
    Parameters
    Type Name Description
    Subsembly.Crypto.CryRSA aPublicKey
    Returns
    Type Description
    System.Boolean
    In This Article
    Back to top Copyright 2009-2025 Subsembly GmbH