IdentityShroud/IdentityShroud.Core/Messages/JsonWebKey.cs
2026-02-06 19:58:01 +01:00

34 lines
No EOL
998 B
C#

using System.Text.Json.Serialization;
namespace IdentityShroud.Core.Messages;
public class JsonWebKey
{
[JsonPropertyName("kty")]
public string KeyType { get; set; } = "RSA";
[JsonPropertyName("use")]
public string Use { get; set; } = "sig"; // "sig" for signature, "enc" for encryption
[JsonPropertyName("alg")]
public string Algorithm { get; set; } = "RS256";
[JsonPropertyName("kid")]
public string KeyId { get; set; }
// RSA Public Key Components
[JsonPropertyName("n")]
public string Modulus { get; set; }
[JsonPropertyName("e")]
public string Exponent { get; set; }
// Optional fields
[JsonPropertyName("x5c")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public List<string> X509CertificateChain { get; set; }
[JsonPropertyName("x5t")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)]
public string X509CertificateThumbprint { get; set; }
}