public APIResult NewCertificate(string domainIdentifierAlias, string certAlias, string[] subjectAlternativeNameIdentifiers) { if (UsePowershell) { return(powershellManager.NewCertificate(domainIdentifierAlias, certAlias, subjectAlternativeNameIdentifiers)); } else { var cmd = new ACMESharp.POSH.NewCertificate(); cmd.IdentifierRef = domainIdentifierAlias; cmd.Alias = certAlias; if (subjectAlternativeNameIdentifiers != null) { cmd.AlternativeIdentifierRefs = subjectAlternativeNameIdentifiers; } cmd.Generate = new System.Management.Automation.SwitchParameter(true); try { cmd.ExecuteCommand(); return(new APIResult { IsOK = true, Result = cmd.CommandResult }); } catch (Exception exp) { return(new APIResult { IsOK = false, Message = exp.ToString(), Result = cmd.CommandResult }); } } }
public string CreateAndSubmitCertificate(string domainAlias) { var certRef = "cert_" + domainAlias; if (UsePowershell) { powershellManager.NewCertificate(domainAlias, certRef); } else { var cmd = new ACMESharp.POSH.NewCertificate(); cmd.IdentifierRef = domainAlias; cmd.Alias = certRef; cmd.ExecuteCommand(); } ReloadVaultConfig(); try { this.SubmitCertificate(certRef); //give LE time to generate cert before fetching fresh status info Thread.Sleep(1000); } catch (Exception exp) { System.Diagnostics.Debug.WriteLine(exp.ToString()); } ReloadVaultConfig(); UpdateAndExportCertificate(certRef); return(certRef); }