Skip to main content

RsaJsonWebKey Class

Abblix.Jwt

Abblix.Jwt

RsaJsonWebKey Class

Represents an RSA JSON Web Key (JWK) containing RSA-specific cryptographic parameters. Supports both public and private RSA keys per RFC 7518 Section 6.3.

public sealed record RsaJsonWebKey : Abblix.Jwt.JsonWebKey, System.IEquatable<Abblix.Jwt.RsaJsonWebKey>

Inheritance System.ObjectJsonWebKey → RsaJsonWebKey

Implements System.IEquatable<RsaJsonWebKey>

Properties

RsaJsonWebKey.Exponent Property

RSA Public Key Exponent (e). Part of the RSA public key. This is a required parameter for RSA public keys.

public byte[]? Exponent { get; set; }

Property Value

System.Byte[]

RsaJsonWebKey.FirstCrtCoefficient Property

RSA First CRT Coefficient (qi). Part of the RSA private key in CRT format. Computed as q^(-1) mod p, the modular multiplicative inverse of q modulo p.

public byte[]? FirstCrtCoefficient { get; set; }

Property Value

System.Byte[]

RsaJsonWebKey.FirstFactorCrtExponent Property

RSA First Factor CRT Exponent (dp). Part of the RSA private key in Chinese Remainder Theorem (CRT) format. Computed as d mod (p-1), where d is the private exponent and p is the first prime factor.

public byte[]? FirstFactorCrtExponent { get; set; }

Property Value

System.Byte[]

RsaJsonWebKey.FirstPrimeFactor Property

RSA First Prime Factor (p). Part of the RSA private key. Used in Chinese Remainder Theorem (CRT) optimization for RSA operations.

public byte[]? FirstPrimeFactor { get; set; }

Property Value

System.Byte[]

RsaJsonWebKey.HasPrivateKey Property

Checks if the key contains private key material.

public override bool HasPrivateKey { get; }

Property Value

System.Boolean

RsaJsonWebKey.HasPublicKey Property

Checks if the key contains public key material.

public override bool HasPublicKey { get; }

Property Value

System.Boolean

RsaJsonWebKey.KeyType Property

The key type identifier for RSA keys. Always returns "RSA".

public override string KeyType { get; }

Property Value

System.String

RsaJsonWebKey.Modulus Property

RSA Public Key Modulus (n). Part of the RSA public key. This is a required parameter for RSA public keys.

public byte[]? Modulus { get; set; }

Property Value

System.Byte[]

RsaJsonWebKey.PrivateExponent Property

RSA Private Exponent (d). Part of the RSA private key. This parameter must be kept confidential and should only be present in private keys.

public byte[]? PrivateExponent { get; set; }

Property Value

System.Byte[]

RsaJsonWebKey.SecondFactorCrtExponent Property

RSA Second Factor CRT Exponent (dq). Part of the RSA private key in CRT format. Computed as d mod (q-1), where d is the private exponent and q is the second prime factor.

public byte[]? SecondFactorCrtExponent { get; set; }

Property Value

System.Byte[]

RsaJsonWebKey.SecondPrimeFactor Property

RSA Second Prime Factor (q). Part of the RSA private key. Used in Chinese Remainder Theorem (CRT) optimization for RSA operations.

public byte[]? SecondPrimeFactor { get; set; }

Property Value

System.Byte[]

Methods

RsaJsonWebKey.Sanitize(bool) Method

Prepares a sanitized version of the RSA JWK that excludes private key information unless explicitly included.

public override Abblix.Jwt.JsonWebKey Sanitize(bool includePrivateKeys);

Parameters

includePrivateKeys System.Boolean

Whether to include private key data in the sanitized output.

Returns

JsonWebKey
A new instance of RsaJsonWebKey with or without private key data based on the input parameter.

Exceptions

System.InvalidOperationException
Thrown when includePrivateKeys is true but the key contains no private key data.