public App(AcmeClient acmeClient, ICertificateStore certificateStore, AzureWebAppService azureWebAppService, ILogger <App> logger = null) { this.acmeClient = acmeClient; this.certificateStore = certificateStore; this.azureWebAppService = azureWebAppService; this.logger = logger ?? NullLogger <App> .Instance; }
public async Task TestEndToEndGoDaddy() { var dnsProvider = new GoDaddyDnsProviderTest().DnsService; var manager = new AcmeClient(dnsProvider, new DnsLookupService(), new NullCertificateStore()); var dnsRequest = new AcmeDnsRequest() { Host = "*.åbningstider.info", PFXPassword = "******", RegistrationEmail = "*****@*****.**", AcmeEnvironment = new LetsEncryptStagingV2(), CsrInfo = new CsrInfo() { CountryName = "DK", Locality = "Copenhagen", Organization = "Sjkp", OrganizationUnit = "", State = "DK" } }; var res = await manager.RequestDnsChallengeCertificate(dnsRequest); Assert.IsNotNull(res); File.WriteAllBytes($"{dnsRequest.Host.Substring(2)}.pfx", res.CertificateInfo.PfxCertificate); var certService = new AzureWebAppService(new[] { TestHelper.AzureWebAppSettings }); await certService.Install(res); }
public async Task TestEndToEndAzure() { var config = TestHelper.AzureDnsSettings; var manager = new AcmeClient(new AzureDnsProvider(config), new DnsLookupService(), null, this.logger); var dnsRequest = new AcmeDnsRequest() { Host = "*.ai4bots.com", PFXPassword = "******", RegistrationEmail = "*****@*****.**", AcmeEnvironment = new LetsEncryptStagingV2(), CsrInfo = new CsrInfo() { CountryName = "DK", Locality = "DK", Organization = "SJKP", OrganizationUnit = "", State = "DK" } }; var res = await manager.RequestDnsChallengeCertificate(dnsRequest); Assert.IsNotNull(res); File.WriteAllBytes($"{dnsRequest.Host.Substring(2)}.pfx", res.CertificateInfo.PfxCertificate); var pass = new System.Security.SecureString(); Array.ForEach(dnsRequest.PFXPassword.ToCharArray(), c => { pass.AppendChar(c); }); File.WriteAllBytes($"exported-{dnsRequest.Host.Substring(2)}.pfx", res.CertificateInfo.Certificate.Export(System.Security.Cryptography.X509Certificates.X509ContentType.Pkcs12, pass)); var certService = new AzureWebAppService(new[] { TestHelper.AzureWebAppSettings }); await certService.Install(res); }