Class X509KeyContainer
- Namespace
- Fdyay.IdentityServer.Services.KeyManagement
- Assembly
- Fdyay.IdentityServer.Core.dll
An RSA signing key wrapped in a self-signed certificate, for a relying party that wants x5c. Duende's
X509KeyContainer, measured: subject CN= the issuer, SHA-256 with PKCS#1 padding, digital signature key
usage and the server-authentication extended usage, valid from the key's creation for its retirement age.
public sealed class X509KeyContainer : KeyContainer
- Inheritance
-
X509KeyContainer
- Inherited Members
Constructors
X509KeyContainer(byte[], string, string, DateTime)
A certificate-wrapped RSA key from its PKCS#12 bytes.
public X509KeyContainer(byte[] pkcs12, string id, string algorithm, DateTime created)
Parameters
pkcs12byte[]The certificate and its private key, as PKCS#12 with no password.
idstringThe key id (
kid).algorithmstringThe signing algorithm, such as
RS256.createdDateTimeWhen the key was created (UTC).
Exceptions
- ArgumentException
idoralgorithmis null or empty.- ArgumentNullException
pkcs12is null.
Properties
Certificate
The certificate, private key included.
public X509Certificate2 Certificate { get; }
Property Value
HasX509Certificate
Whether the key is wrapped in an X.509 certificate, published as x5c.
public override bool HasX509Certificate { get; }
Property Value
Remarks
Always true.
Methods
Create(int, string, string, DateTime, string, TimeSpan)
Generates a new RSA key and its certificate.
public static X509KeyContainer Create(int keySize, string algorithm, string id, DateTime created, string issuer, TimeSpan certificateLifetime)
Parameters
Returns
ExportPkcs12()
The certificate and its private key, as PKCS#12 bytes with no password.
public byte[] ExportPkcs12()
Returns
- byte[]
ToPublicJsonWebKey()
Produces the public JSON Web Key used for the JWKS and token validation.
public override JsonWebKey ToPublicJsonWebKey()
Returns
ToSecurityKey()
The key, private half included, as the token handler signs with it.
public override SecurityKey ToSecurityKey()