Table of Contents

Class EcKeyContainer

Namespace
Fdyay.IdentityServer.Services.KeyManagement
Assembly
Fdyay.IdentityServer.Core.dll

An EC signing key on the curve its algorithm names — ES256 P-256, ES384 P-384, ES512 P-521. Duende's EcKeyContainer.

public sealed class EcKeyContainer : KeyContainer
Inheritance
EcKeyContainer
Inherited Members

Constructors

EcKeyContainer(ECParameters, string, string, DateTime)

An EC key from its parameters.

public EcKeyContainer(ECParameters parameters, string id, string algorithm, DateTime created)

Parameters

parameters ECParameters

The key's curve and points, private key included.

id string

The key id (kid).

algorithm string

The signing algorithm, such as RS256.

created DateTime

When the key was created (UTC).

Exceptions

ArgumentException

id or algorithm is null or empty.

Methods

Create(string, string, DateTime)

Generates a new key on the curve algorithm names.

public static EcKeyContainer Create(string algorithm, string id, DateTime created)

Parameters

algorithm string
id string
created DateTime

Returns

EcKeyContainer

ExportPrivateKey()

Exports the private key as PKCS#8 DER bytes.

public byte[] ExportPrivateKey()

Returns

byte[]

FromPrivateKey(byte[], string, string, DateTime)

Creates a container from PKCS#8 DER private key bytes.

public static EcKeyContainer FromPrivateKey(byte[] pkcs8PrivateKey, string id, string algorithm, DateTime created)

Parameters

pkcs8PrivateKey byte[]
id string
algorithm string
created DateTime

Returns

EcKeyContainer

ToPublicJsonWebKey()

Produces the public JSON Web Key used for the JWKS and token validation.

public override JsonWebKey ToPublicJsonWebKey()

Returns

JsonWebKey

Exceptions

InvalidOperationException

Algorithm is not ES256, ES384 or ES512.

ToSecurityKey()

The key, private half included, as the token handler signs with it.

public override SecurityKey ToSecurityKey()

Returns

SecurityKey