CertificateEngineProperties.cs 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. using System;
  2. using System.Linq;
  3. using System.Security;
  4. using InABox.Core;
  5. namespace PRSServer
  6. {
  7. public class CertificateEngineProperties : ServerProperties
  8. {
  9. [NullEditor]
  10. public const string LetsEncryptV2StagingEndpoint = "https://acme-staging-v02.api.letsencrypt.org/";
  11. [NullEditor]
  12. public const string LetsEncryptV2Endpoint = "https://acme-v02.api.letsencrypt.org/";
  13. [NullEditor]
  14. public const int DefaultRsaKeySize = 2048;
  15. [NullEditor]
  16. public const int DefaultEcKeySize = 256;
  17. [EditorSequence(1)]
  18. [MemoEditor]
  19. [Caption("Domain Name(s) to Register:")]
  20. public string DomainNames { get; set; }
  21. public string[] ParseDomainNames() => DomainNames
  22. .Replace(" ","")
  23. .Split(new char[] { ',',';','\n','\r'}, StringSplitOptions.RemoveEmptyEntries)
  24. .Select(x=>x.Trim())
  25. .ToArray();
  26. [EditorSequence(2)]
  27. [TextBoxEditor]
  28. [Caption("Contact Email for Let's Encrypt")]
  29. public string AccountContactEmails { get; set; }
  30. [NullEditor]
  31. public string AcmeRootDir { get; set; } = "_acmesharp";
  32. [NullEditor]
  33. public string CaUrl { get; set; } = LetsEncryptV2Endpoint;
  34. [NullEditor]
  35. public string AccountKeyAlgor { get; set; } = "ec";
  36. [NullEditor]
  37. public int? AccountKeySize { get; set; }
  38. [NullEditor]
  39. public bool AcceptTermsOfService { get; set; }
  40. [NullEditor]
  41. public bool TestChallenges { get; }
  42. [NullEditor]
  43. public string CertificateKeyAlgor { get; set; } = "ec";
  44. [NullEditor]
  45. public int? CertificateKeySize { get; set; }
  46. [NullEditor]
  47. public int WaitForAuthorizations { get; set; } = 60;
  48. [NullEditor]
  49. public int WaitForCertificate { get; set; } = 60;
  50. public override ServerType Type()
  51. {
  52. return ServerType.Certificate;
  53. }
  54. public CertificateEngineProperties()
  55. {
  56. AcceptTermsOfService = true;
  57. DomainNames = "";
  58. AccountContactEmails = "";
  59. }
  60. }
  61. }