Table of Contents

Class LicenseX509Service

Namespace
OneImlx.Shared.Licensing
Assembly
OneImlx.Shared.dll

The licensing services around X509Certificate2.

public sealed class LicenseX509Service
Inheritance
LicenseX509Service
Inherited Members

Methods

FromJwtValidationKey(string, out X509Certificate2)

Returns the public validation key and certificate from a JWT token.

public static string FromJwtValidationKey(string jwtVKey, out X509Certificate2 x509Certificate)

Parameters

jwtVKey string

The JWT from which the public validation key is extracted.

x509Certificate X509Certificate2

Outputs the X509Certificate2 created from the extracted public key.

Returns

string

The extracted public validation key.

Exceptions

ErrorException

Thrown if the JWT does not contain a pkey claim indicating the public validation key, or if the generated certificate inadvertently contains a private key, indicating unauthorized access.

ToJwtValidationKey(X509Certificate2)

Returns an unsigned JWT token containing the public key of a given certificate.

public static string ToJwtValidationKey(X509Certificate2 certificate)

Parameters

certificate X509Certificate2

The certificate containing the public key to be distributed.

Returns

string

An unsigned JWT token with the public key in the payload.

Remarks

The method exports the public key from the provided X509Certificate2 object, encodes it in Base64, and constructs an unsigned JWT token with the public key included in the payload under the pkey claim. This JWT token does not contain a signature or expiration, making it suitable for public distribution.

ToSigningCertificate(string, string?)

Returns the signing certificate.

public static X509Certificate2 ToSigningCertificate(string cert, string? pwd = null)

Parameters

cert string
pwd string

Returns

X509Certificate2