internal AcmeOrders(AcmeClient Client, HttpResponseMessage Response, IEnumerable <KeyValuePair <string, object> > Obj) : base(Client) { this.next = AcmeClient.GetLink(Response, "next"); foreach (KeyValuePair <string, object> P in Obj) { switch (P.Key) { case "orders": if (P.Value is Array A) { List <Uri> Orders = new List <Uri>(); foreach (object Obj2 in A) { if (Obj2 is string s) { Orders.Add(new Uri(s)); } } this.orders = Orders.ToArray(); } break; } } }
internal AcmeIdentifier(AcmeClient Client, IEnumerable <KeyValuePair <string, object> > Obj) : base(Client) { foreach (KeyValuePair <string, object> P in Obj) { switch (P.Key) { case "type": this.type = P.Value as string; break; case "value": this.value = P.Value as string; break; } } }
internal AcmeChallenge(AcmeClient Client, Uri AccountLocation, IEnumerable <KeyValuePair <string, object> > Obj) : base(Client, AccountLocation, null) { foreach (KeyValuePair <string, object> P in Obj) { switch (P.Key) { case "status": if (!Enum.TryParse <AcmeChallengeStatus>(P.Value as string, out this.status)) { throw new ArgumentException("Invalid ACME challenge status: " + P.Value.ToString(), "status"); } break; case "validated": if (XML.TryParse(P.Value as string, out DateTime TP)) { this.validated = TP; } else { throw new ArgumentException("Invalid date and time value.", "validated"); } break; case "url": this.Location = new Uri(P.Value as string); break; case "type": this.type = P.Value as string; break; case "token": this.token = P.Value as string; break; } } }
internal AcmeHttpChallenge(AcmeClient Client, Uri AccountLocation, IEnumerable <KeyValuePair <string, object> > Obj) : base(Client, AccountLocation, Obj) { }
internal AcmeAccount(AcmeClient Client, Uri Location, IEnumerable <KeyValuePair <string, object> > Obj) : base(Client, Location, Location) { foreach (KeyValuePair <string, object> P in Obj) { switch (P.Key) { case "status": if (!Enum.TryParse <AcmeAccountStatus>(P.Value as string, out this.status)) { throw new ArgumentException("Invalid ACME account status: " + P.Value.ToString(), "status"); } break; case "contact": if (P.Value is Array A) { List <string> Contact = new List <string>(); foreach (object Obj2 in A) { if (Obj2 is string s) { Contact.Add(s); } } this.contact = Contact.ToArray(); } break; case "termsOfServiceAgreed": if (CommonTypes.TryParse(P.Value as string, out bool b)) { this.termsOfServiceAgreed = b; } else { throw new ArgumentException("Invalid boolean value.", "termsOfServiceAgreed"); } break; case "orders": this.orders = new Uri(P.Value as string); break; case "initialIp": this.initialIp = P.Value as string; break; case "createdAt": if (XML.TryParse(P.Value as string, out DateTime TP)) { this.createdAt = TP; } else { throw new ArgumentException("Invalid date and time value.", "createdAt"); } break; } } }
/// <summary> /// Represents an ACME identifier. /// </summary> /// <param name="Client">ACME Client.</param> /// <param name="Type">Type of identifier.</param> /// <param name="Value">Identifier value.</param> public AcmeIdentifier(AcmeClient Client, string Type, string Value) : base(Client) { this.type = Type; this.value = Value; }
/// <summary> /// Abstract base class for all ACME objects. /// </summary> /// <param name="Client">ACME client.</param> public AcmeObject(AcmeClient Client) { this.client = Client; }
/// <summary> /// Abstract base class for all ACME objects. /// </summary> /// <param name="Client">ACME client.</param> /// <param name="AccountLocation">Account resource location.</param> /// <param name="Location">ACME resource location.</param> public AcmeResource(AcmeClient Client, Uri AccountLocation, Uri Location) : base(Client) { this.accountLocation = AccountLocation; this.location = Location; }
internal AcmeOrder(AcmeClient Client, Uri AccountLocation, Uri Location, IEnumerable <KeyValuePair <string, object> > Obj, HttpResponseMessage Response) : base(Client, AccountLocation, Location) { foreach (KeyValuePair <string, object> P in Obj) { switch (P.Key) { case "status": if (!Enum.TryParse <AcmeOrderStatus>(P.Value as string, out this.status)) { throw new ArgumentException("Invalid ACME order status: " + P.Value.ToString(), "status"); } break; case "expires": if (XML.TryParse(P.Value as string, out DateTime TP)) { this.expires = TP; } else { throw new ArgumentException("Invalid date and time value.", "expires"); } break; case "notBefore": if (XML.TryParse(P.Value as string, out TP)) { this.notBefore = TP; } else { throw new ArgumentException("Invalid date and time value.", "notBefore"); } break; case "notAfter": if (XML.TryParse(P.Value as string, out TP)) { this.notAfter = TP; } else { throw new ArgumentException("Invalid date and time value.", "notAfter"); } break; case "identifiers": if (P.Value is Array A) { List <AcmeIdentifier> Identifiers = new List <AcmeIdentifier>(); foreach (object Obj2 in A) { if (Obj2 is IEnumerable <KeyValuePair <string, object> > Obj3) { Identifiers.Add(new AcmeIdentifier(Client, Obj3)); } } this.identifiers = Identifiers.ToArray(); } break; case "authorizations": if (P.Value is Array A2) { List <Uri> Authorizations = new List <Uri>(); foreach (object Obj2 in A2) { if (Obj2 is string s) { Authorizations.Add(new Uri(s)); } } this.authorizationUris = Authorizations.ToArray(); } break; case "finalize": this.finalize = new Uri(P.Value as string); break; case "certificate": this.certificate = new Uri(P.Value as string); break; case "error": if (P.Value is IEnumerable <KeyValuePair <string, object> > ErrorObj) { this.error = AcmeClient.CreateException(ErrorObj, Response); } break; } } }
internal AcmeAuthorization(AcmeClient Client, Uri AccountLocation, Uri Location, IEnumerable <KeyValuePair <string, object> > Obj) : base(Client, AccountLocation, Location) { foreach (KeyValuePair <string, object> P in Obj) { switch (P.Key) { case "status": if (!Enum.TryParse <AcmeAuthorizationStatus>(P.Value as string, out this.status)) { throw new ArgumentException("Invalid ACME authorization status: " + P.Value.ToString(), "status"); } break; case "expires": if (XML.TryParse(P.Value as string, out DateTime TP)) { this.expires = TP; } else { throw new ArgumentException("Invalid date and time value.", "expires"); } break; case "identifier": if (P.Value is IEnumerable <KeyValuePair <string, object> > Obj2) { foreach (KeyValuePair <string, object> P2 in Obj2) { switch (P2.Key) { case "type": this.type = P2.Value as string; break; case "value": this.value = P2.Value as string; break; } } } break; case "challenges": if (P.Value is Array A2) { List <AcmeChallenge> Challenges = new List <AcmeChallenge>(); foreach (object Obj3 in A2) { if (Obj3 is IEnumerable <KeyValuePair <string, object> > Obj4) { Challenges.Add(this.Client.CreateChallenge(AccountLocation, Obj4)); } } this.challenges = Challenges.ToArray(); } break; case "wildcard": if (CommonTypes.TryParse(P.Value as string, out bool b)) { this.wildcard = b; } else { throw new ArgumentException("Invalid boolean value.", "wildcard"); } break; } } }
internal AcmeDirectory(AcmeClient Client, IEnumerable <KeyValuePair <string, object> > Obj) : base(Client) { foreach (KeyValuePair <string, object> P in Obj) { switch (P.Key) { case "keyChange": this.keyChange = new Uri(P.Value as string); break; case "meta": if (P.Value is IEnumerable <KeyValuePair <string, object> > Obj2) { foreach (KeyValuePair <string, object> P2 in Obj2) { switch (P2.Key) { case "caaIdentities": if (P2.Value is Array A) { List <string> CaaIdentities = new List <string>(); foreach (object Obj3 in A) { if (Obj3 is string s) { CaaIdentities.Add(s); } } this.caaIdentities = CaaIdentities.ToArray(); } break; case "termsOfService": this.termsOfService = new Uri(P2.Value as string); break; case "website": this.website = new Uri(P2.Value as string); break; case "externalAccountRequired": if (P2.Value is bool b) { this.externalAccountRequired = b; } break; } } } break; case "newAccount": this.newAccount = new Uri(P.Value as string); break; case "newNonce": this.newNonce = new Uri(P.Value as string); break; case "newOrder": this.newOrder = new Uri(P.Value as string); break; case "revokeCert": this.revokeCert = new Uri(P.Value as string); break; case "newAuthz": this.newAuthz = new Uri(P.Value as string); break; } } }