2026-02-27 17:57:42 +00:00
|
|
|
using IdentityShroud.Core.Messages;
|
|
|
|
|
|
|
|
|
|
namespace IdentityShroud.Core.Security.Keys;
|
|
|
|
|
|
2026-03-16 19:15:04 +01:00
|
|
|
public class KeyPolicy
|
2026-02-27 17:57:42 +00:00
|
|
|
{
|
2026-03-16 19:15:04 +01:00
|
|
|
public KeyType KeyType { get; protected init; }
|
|
|
|
|
public int KeySize { get; protected init; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public record KeyData(byte[] PrivateKey, Dictionary<string, string>? PublicKeyParameters = null)
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// The data to be kept private, also used for symmetric keys
|
|
|
|
|
/// </summary>
|
|
|
|
|
public byte[] PrivateKey { get; set; } = PrivateKey;
|
|
|
|
|
|
|
|
|
|
public Dictionary<string, string>? PublicKeyParameters { get; set; } = PublicKeyParameters;
|
2026-02-27 17:57:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public interface IKeyProvider
|
|
|
|
|
{
|
2026-03-16 19:15:04 +01:00
|
|
|
/// <summary>
|
|
|
|
|
/// Returns true when this key uses public key cryptography
|
|
|
|
|
/// </summary>
|
|
|
|
|
bool IsPublic { get; }
|
|
|
|
|
KeyData CreateKey(KeyPolicy policy);
|
2026-02-27 17:57:42 +00:00
|
|
|
|
2026-03-16 19:15:04 +01:00
|
|
|
void SetJwkParameters(Dictionary<string, string> parameters, JsonWebKey jwk);
|
2026-02-27 17:57:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|