Ejemplo n.º 1
0
        /// <summary>
        /// Get the CsrPlugin which is used to generate the private key
        /// and request the certificate
        /// </summary>
        /// <returns></returns>
        public virtual async Task <ICsrPluginOptionsFactory?> GetCsrPlugin(ILifetimeScope scope)
        {
            var pluginName = _options.MainArguments.Csr;

            if (string.IsNullOrEmpty(pluginName))
            {
                return(scope.Resolve <RsaOptionsFactory>());
            }
            var ret = _plugins.CsrPluginFactory(scope, pluginName);

            if (ret == null)
            {
                _log.Error("Unable to find csr plugin {PluginName}", pluginName);
                return(new NullCsrFactory());
            }
            if (ret.Disabled)
            {
                _log.Error("CSR plugin {PluginName} is not available to the current user, try running as administrator", pluginName);
                return(new NullCsrFactory());
            }
            return(ret);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Get the CsrPlugin which is used to generate the private key
        /// and request the certificate
        /// </summary>
        /// <returns></returns>
        public virtual async Task <ICsrPluginOptionsFactory> GetCsrPlugin(ILifetimeScope scope)
        {
            var pluginName = _options.MainArguments.Csr;

            if (string.IsNullOrEmpty(pluginName))
            {
                return(scope.Resolve <RsaOptionsFactory>());
            }
            var factory = _plugins.CsrPluginFactory(scope, pluginName);

            if (factory == null)
            {
                _log.Error("Unable to find csr plugin {PluginName}", pluginName);
                return(new NullCsrFactory());
            }
            var(disabled, disabledReason) = factory.Disabled;
            if (disabled)
            {
                _log.Error($"CSR plugin {{PluginName}} is not available. {disabledReason}", pluginName);
                return(new NullCsrFactory());
            }
            return(factory);
        }