using System; using System.Linq; using System.Security; using InABox.Core; namespace PRSServer { public class CertificateEngineProperties : ServerProperties { [NullEditor] public const string LetsEncryptV2StagingEndpoint = "https://acme-staging-v02.api.letsencrypt.org/"; [NullEditor] public const string LetsEncryptV2Endpoint = "https://acme-v02.api.letsencrypt.org/"; [NullEditor] public const int DefaultRsaKeySize = 2048; [NullEditor] public const int DefaultEcKeySize = 256; [EditorSequence(1)] [MemoEditor] [Caption("Domain Name(s) to Register:")] public string DomainNames { get; set; } public string[] ParseDomainNames() => DomainNames .Replace(" ","") .Split(new char[] { ',',';','\n','\r'}, StringSplitOptions.RemoveEmptyEntries) .Select(x=>x.Trim()) .ToArray(); [EditorSequence(2)] [TextBoxEditor] [Caption("Contact Email for Let's Encrypt")] public string AccountContactEmails { get; set; } [NullEditor] public string AcmeRootDir { get; set; } = "_acmesharp"; [NullEditor] public string CaUrl { get; set; } = LetsEncryptV2Endpoint; [NullEditor] public string AccountKeyAlgor { get; set; } = "ec"; [NullEditor] public int? AccountKeySize { get; set; } [NullEditor] public bool AcceptTermsOfService { get; set; } [NullEditor] public bool TestChallenges { get; } [NullEditor] public string CertificateKeyAlgor { get; set; } = "ec"; [NullEditor] public int? CertificateKeySize { get; set; } [NullEditor] public int WaitForAuthorizations { get; set; } = 60; [NullEditor] public int WaitForCertificate { get; set; } = 60; public override ServerType Type() { return ServerType.Certificate; } public CertificateEngineProperties() { AcceptTermsOfService = true; DomainNames = ""; AccountContactEmails = ""; } } }