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
parametersECParametersThe key's curve and points, private key included.
idstringThe key id (
kid).algorithmstringThe signing algorithm, such as
RS256.createdDateTimeWhen the key was created (UTC).
Exceptions
- ArgumentException
idoralgorithmis 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
Returns
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
Returns
ToPublicJsonWebKey()
Produces the public JSON Web Key used for the JWKS and token validation.
public override JsonWebKey ToPublicJsonWebKey()
Returns
Exceptions
- InvalidOperationException
Algorithm is not
ES256,ES384orES512.
ToSecurityKey()
The key, private half included, as the token handler signs with it.
public override SecurityKey ToSecurityKey()