Class RsaKeyContainer
- Namespace
- Fdyay.IdentityServer.Services.KeyManagement
- Assembly
- Fdyay.IdentityServer.Core.dll
An RSA signing key plus its metadata. Holds RSAParameters (a value type) so the container itself owns no unmanaged resources; RSA instances are created on demand by RsaSecurityKey, which owns and disposes them.
public sealed class RsaKeyContainer : KeyContainer
- Inheritance
-
RsaKeyContainer
- Inherited Members
Constructors
RsaKeyContainer(RSAParameters, string, string, DateTime)
An RSA key from its parameters.
public RsaKeyContainer(RSAParameters parameters, string id, string algorithm, DateTime created)
Parameters
parametersRSAParametersThe key's parameters, 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(int, string, string, DateTime)
Generates a brand new RSA key of the given size.
public static RsaKeyContainer Create(int keySize, string algorithm, string id, DateTime created)
Parameters
Returns
ExportPrivateKey()
Exports the private key material as PKCS#1 DER bytes.
public byte[] ExportPrivateKey()
Returns
- byte[]
FromPrivateKey(byte[], string, string, DateTime)
Creates a container from PKCS#1 DER private key bytes.
public static RsaKeyContainer FromPrivateKey(byte[] pkcs1PrivateKey, 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
ToSecurityKey()
The key, private half included, as the token handler signs with it.
public override SecurityKey ToSecurityKey()