From da5b6aa4f937266a6a4d6796ceb1daef0c9eba95 Mon Sep 17 00:00:00 2001 From: Gurucharan Subramani Date: Wed, 11 Jun 2025 19:07:36 +0200 Subject: [PATCH] Extend ACME SharpCore to support ARI --- src/ACMESharp/Protocol/AcmeProtocolClient.cs | 5 ++++- src/ACMESharp/Protocol/Messages/CreateOrderRequest.cs | 3 +++ src/ACMESharp/Protocol/Resources/ServiceDirectory.cs | 3 +++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/ACMESharp/Protocol/AcmeProtocolClient.cs b/src/ACMESharp/Protocol/AcmeProtocolClient.cs index 7169bd4..0913271 100644 --- a/src/ACMESharp/Protocol/AcmeProtocolClient.cs +++ b/src/ACMESharp/Protocol/AcmeProtocolClient.cs @@ -380,6 +380,7 @@ public async Task DeactivateAccountAsync( /// https://tools.ietf.org/html/draft-ietf-acme-acme-12#section-7.1.3 /// public async Task CreateOrderAsync(IEnumerable identifiers, + string replacesCertificateId = null, DateTime? notBefore = null, DateTime? notAfter = null, CancellationToken cancel = default(CancellationToken)) @@ -389,6 +390,7 @@ public async Task CreateOrderAsync(IEnumerable identif Identifiers = identifiers.ToArray(), NotBefore = notBefore?.ToString(Constants.Rfc3339DateTimeFormat), NotAfter = notAfter?.ToString(Constants.Rfc3339DateTimeFormat), + Replaces = replacesCertificateId }; var resp = await SendAcmeAsync( new Uri(_http.BaseAddress, Directory.NewOrder), @@ -412,11 +414,12 @@ public async Task CreateOrderAsync(IEnumerable identif /// https://tools.ietf.org/html/draft-ietf-acme-acme-12#section-7.1.3 /// public Task CreateOrderAsync(IEnumerable dnsIdentifiers, + string replacesCertificateId = null, DateTime? notBefore = null, DateTime? notAfter = null, CancellationToken cancel = default(CancellationToken)) => CreateOrderAsync( dnsIdentifiers.Select(dns => new Identifier() { Type = "dns", Value = dns }).ToArray(), - notBefore, notAfter, cancel); + replacesCertificateId, notBefore, notAfter, cancel); /// /// Retrieves the current status and details of an existing Order. diff --git a/src/ACMESharp/Protocol/Messages/CreateOrderRequest.cs b/src/ACMESharp/Protocol/Messages/CreateOrderRequest.cs index bd1a8a7..ae14581 100644 --- a/src/ACMESharp/Protocol/Messages/CreateOrderRequest.cs +++ b/src/ACMESharp/Protocol/Messages/CreateOrderRequest.cs @@ -19,5 +19,8 @@ public class CreateOrderRequest [JsonProperty("notAfter", NullValueHandling = NullValueHandling.Ignore)] public string NotAfter { get; set; } + + [JsonProperty("replaces", NullValueHandling = NullValueHandling.Ignore)] + public string Replaces { get; set; } } } \ No newline at end of file diff --git a/src/ACMESharp/Protocol/Resources/ServiceDirectory.cs b/src/ACMESharp/Protocol/Resources/ServiceDirectory.cs index 6ff74a5..d9c82dc 100644 --- a/src/ACMESharp/Protocol/Resources/ServiceDirectory.cs +++ b/src/ACMESharp/Protocol/Resources/ServiceDirectory.cs @@ -34,6 +34,9 @@ public class ServiceDirectory [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] public string KeyChange { get; set; } //! = "acme/key-change"; + [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public string RenewalInfo { get; set; } //! = "acme/renewal-info"; + public DirectoryMeta Meta { get; set; } public IEnumerable GetExtraNames() => _extra?.Keys;