Exemplo n.º 1
0
        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
                    });
                }
            }
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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);
        }