Skip to content
Introducing the next era of Duende IdentityServer. Read our CEO’s announcement

Signing Key Store

Duende.IdentityServer.Stores.ISigningKeyStore

Section titled “Duende.IdentityServer.Stores.ISigningKeyStore”

Used to manage storage of cryptographic signing keys used for token signing.

/// <summary>
/// Interface to model storage of serialized keys.
/// </summary>
public interface ISigningKeyStore
{
/// <summary>
/// Returns all the keys in storage.
/// </summary>
/// <param name="ct">The cancellation token.</param>
/// <returns></returns>
Task<IReadOnlyCollection<SerializedKey>> LoadKeysAsync(CancellationToken ct);
/// <summary>
/// Persists new key in storage.
/// </summary>
/// <param name="key"></param>
/// <param name="ct">The cancellation token.</param>
/// <returns></returns>
Task StoreKeyAsync(SerializedKey key, CancellationToken ct);
/// <summary>
/// Deletes key from storage.
/// </summary>
/// <param name="id"></param>
/// <param name="ct">The cancellation token.</param>
/// <returns></returns>
Task DeleteKeyAsync(string id, CancellationToken ct);
}
/// <summary>
/// Serialized key.
/// </summary>
public class SerializedKey
{
/// <summary>
/// Version number of serialized key.
/// </summary>
public int Version { get; set; }
/// <summary>
/// Key identifier.
/// </summary>
public string Id { get; set; }
/// <summary>
/// Date key was created.
/// </summary>
public DateTime Created { get; set; }
/// <summary>
/// The algorithm.
/// </summary>
public string Algorithm { get; set; }
/// <summary>
/// Contains X509 certificate.
/// </summary>
public bool IsX509Certificate { get; set; }
/// <summary>
/// Serialized data for key.
/// </summary>
public string Data { get; set; }
/// <summary>
/// Indicates if data is protected.
/// </summary>
public bool DataProtected { get; set; }
}