2using System.Collections.Generic;
4using System.Security.Cryptography.X509Certificates;
5using System.Threading.Tasks;
52 private readonly DateTime? expires =
null;
53 private readonly DateTime? notBefore =
null;
54 private readonly DateTime? notAfter =
null;
57 private readonly Uri[] authorizationUris =
null;
59 private readonly Uri finalize =
null;
60 private readonly Uri certificate =
null;
63 IEnumerable<KeyValuePair<string, object>> Obj, HttpResponseMessage Response)
66 foreach (KeyValuePair<string, object> P
in Obj)
71 if (!Enum.TryParse(P.Value as
string, out
this.status))
72 throw new ArgumentException(
"Invalid ACME order status: " + P.Value.ToString(),
"status");
76 if (
XML.
TryParse(P.Value as
string, out DateTime TP))
79 throw new ArgumentException(
"Invalid date and time value.",
"expires");
86 throw new ArgumentException(
"Invalid date and time value.",
"notBefore");
93 throw new ArgumentException(
"Invalid date and time value.",
"notAfter");
97 if (P.Value is Array A)
99 List<AcmeIdentifier>
Identifiers =
new List<AcmeIdentifier>();
101 foreach (
object Obj2
in A)
103 if (Obj2 is IEnumerable<KeyValuePair<string, object>> Obj3)
111 case "authorizations":
112 if (P.Value is Array A2)
116 foreach (
object Obj2
in A2)
118 if (Obj2 is
string s)
127 this.finalize =
new Uri(P.Value as
string);
131 this.certificate =
new Uri(P.Value as
string);
135 if (P.Value is IEnumerable<KeyValuePair<string, object>> ErrorObj)
136 this.error =
AcmeClient.CreateException(ErrorObj, Response);
194 return this.Client.
GetOrder(this.AccountLocation, this.Location);
203 if (this.authorizations is
null)
205 int i, c = this.authorizationUris.Length;
208 for (i = 0; i < c; i++)
210 Uri
Location = this.authorizationUris[i];
212 (await this.Client.POST_as_GET(
Location,
this.AccountLocation)).Payload);
215 this.authorizations = Result;
218 return this.authorizations;
245 if (this.certificate is
null)
246 throw new Exception(
"No certificate URI available.");
Helps with common XML-related tasks.
static bool TryParse(string s, out DateTime Value)
Tries to decode a string encoded DateTime.
Represents an ACME authorization.
Implements an ACME client for the generation of certificates using ACME-compliant certificate servers...
async Task< AcmeOrder > GetOrder(Uri AccountLocation, Uri OrderLocation)
Gets the state of an order.
async Task< AcmeOrder > FinalizeOrder(Uri AccountLocation, Uri FinalizeLocation, CertificateRequest CertificateRequest)
Finalize order.
async Task< X509Certificate2[]> DownloadCertificate(Uri AccountLocation, Uri CertificateLocation)
Downloads a certificate.
Represents an ACME problem report.
Represents an ACME identifier.
AcmeClient Client
ACME client.
Represents an ACME order.
DateTime? Expires
The timestamp after which the server will consider this order invalid
Task< AcmeOrder > Poll()
Gets the current state of the order.
AcmeOrderStatus Status
The status of this order.
Uri[] AuthorizationUris
For pending orders, the authorizations that the client needs to complete before the requested certifi...
AcmeException Error
Any error, if available.
Uri Certificate
A URL for the certificate that has been issued in response to this order.
DateTime? NotBefore
The requested value of the notBefore field in the certificate
async Task< AcmeAuthorization[]> GetAuthorizations()
Gets current authorization objects.
DateTime? NotAfter
The requested value of the notAfter field in the certificate
AcmeIdentifier[] Identifiers
An array of identifier objects that the order pertains to.
Task< X509Certificate2[]> DownloadCertificate()
Downloads the certificate.
Uri Finalize
A URL that a CSR must be POSTed to once all of the order's authorizations are satisfied to finalize t...
Task< AcmeOrder > FinalizeOrder(CertificateRequest CertificateRequest)
Finalize order.
Task< AcmeAuthorization[]> Authorizations
Curernt authorization objects.
Abstract base class for all ACME resources.
Uri Location
Location of resource.
Uri AccountLocation
Account location.
Contains information about a Certificate Signing Request (CSR).
AcmeOrderStatus
ACME Order status enumeration