Skip to content

CertificateJsonWebKeyExtensions Class

Converts an X.509 certificate into a JSON Web Key: its public key, its private key when asked for, the use its Key Usage extension permits, and the certificate itself.

C#
public static class CertificateJsonWebKeyExtensions

Inheritance System.Object → CertificateJsonWebKeyExtensions

Methods

CertificateJsonWebKeyExtensions.Apply<T>(this T, X509Certificate2) Method

Applies X509Certificate2 properties to a JsonWebKey.

C#
public static T Apply<T>(this T jwk, System.Security.Cryptography.X509Certificates.X509Certificate2 certificate)
    where T : Abblix.Jwt.JsonWebKey;

Type parameters

T

The type of JsonWebKey (must be a subclass).

Parameters

jwk T

The JsonWebKey to which the certificate properties are to be applied.

certificate System.Security.Cryptography.X509Certificates.X509Certificate2

The X509Certificate2 providing the properties.

Returns

T
The updated JsonWebKey with applied certificate properties.

CertificateJsonWebKeyExtensions.ToJsonWebKey(this X509Certificate2, bool) Method

Converts an X509Certificate2 to a JsonWebKey. The private keys can be optionally included in the conversion.

C#
public static Abblix.Jwt.JsonWebKey ToJsonWebKey(this System.Security.Cryptography.X509Certificates.X509Certificate2 certificate, bool includePrivateKeys=false);

Parameters

certificate System.Security.Cryptography.X509Certificates.X509Certificate2

The X509Certificate2 to convert.

includePrivateKeys System.Boolean

Indicates whether to include private keys in the conversion.

Returns

JsonWebKey
A JsonWebKey representing the certificate.