EllipticCurveJsonWebKey Class
Abblix.Jwt
Abblix.Jwt
EllipticCurveJsonWebKey Class
Represents an Elliptic Curve JSON Web Key (JWK) containing EC-specific cryptographic parameters. Supports both public and private EC keys per RFC 7518 Section 6.2.
public sealed record EllipticCurveJsonWebKey : Abblix.Jwt.JsonWebKey, System.IEquatable<Abblix.Jwt.EllipticCurveJsonWebKey>
Inheritance System.Object → JsonWebKey → EllipticCurveJsonWebKey
Implements System.IEquatable<EllipticCurveJsonWebKey>
Properties
EllipticCurveJsonWebKey.Curve Property
Elliptic Curve Type (crv). Identifies the curve type for an Elliptic Curve key. Common values include "P-256", "P-384", "P-521" for NIST curves. This is a required parameter for EC keys.
public string? Curve { get; set; }
Property Value
EllipticCurveJsonWebKey.HasPrivateKey Property
Checks if the key contains private key material.
public override bool HasPrivateKey { get; }
Property Value
EllipticCurveJsonWebKey.HasPublicKey Property
Checks if the key contains public key material.
public override bool HasPublicKey { get; }
Property Value
EllipticCurveJsonWebKey.KeyType Property
The key type identifier for Elliptic Curve keys. Always returns "EC".
public override string KeyType { get; }
Property Value
EllipticCurveJsonWebKey.PrivateKey Property
ECC Private Key (d). Represents the private part of an Elliptic Curve key. This parameter must be kept confidential and should only be present in private keys.
public byte[]? PrivateKey { get; set; }
Property Value
EllipticCurveJsonWebKey.X Property
X-coordinate for Elliptic Curve (x). Part of the Elliptic Curve public key. This is a required parameter for EC public keys.
public byte[]? X { get; set; }
Property Value
EllipticCurveJsonWebKey.Y Property
Y-coordinate for Elliptic Curve (y). Part of the Elliptic Curve public key. This is a required parameter for EC public keys.
public byte[]? Y { get; set; }
Property Value
Methods
EllipticCurveJsonWebKey.Sanitize(bool) Method
Prepares a sanitized version of the EC 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 EllipticCurveJsonWebKey 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.