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 CreateCertificate(string domainAlias) { var certRef = "cert_" + domainAlias; //New-ACMECertificate -Identifier dns1 -Alias cert1 -Generate bool certExists = CertExists(domainAlias); if (!certExists) { powershellManager.NewCertificate(domainAlias, certRef); } ReloadVaultConfig(); //return certRef; try { var apiResult = powershellManager.SubmitCertificate(certRef, force: true); //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(domainAlias); return(certRef); }
public string CreateCertificate(string domainAlias) { var certRef = "cert_" + domainAlias; powershellManager.NewCertificate(domainAlias, certRef); ReloadVaultConfig(); try { var apiResult = powershellManager.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); }