public CsrPlugin(ILogService log, ISettingsService settings, TOptions options, PemService pemService) { _log = log; _options = options; _settings = settings; _pemService = pemService; }
public Rsa( ILogService log, ISettingsService settings, PemService pemService, RsaOptions options) : base(log, settings, options, pemService) { }
public PemFiles( ILogService log, ISettingsService settings, PemService pemService, PemFilesOptions options) { _log = log; _pemService = pemService; _password = !string.IsNullOrWhiteSpace(options.PemPassword?.Value) ? options.PemPassword.Value : settings.Store.PemFiles?.DefaultPassword; var path = options.Path; if (string.IsNullOrWhiteSpace(path)) { path = DefaultPath(settings); } if (!string.IsNullOrWhiteSpace(path) && path.ValidPath(log)) { _log.Debug("Using .pem files path: {path}", path); _path = path; } else { throw new Exception($"Specified .pem files path {path} is not valid."); } }
public void Regular() { var tempFile = Path.GetTempFileName(); try { File.WriteAllText(tempFile, Csr); var csrOptions = new CsrOptions() { CsrFile = tempFile }; var log = new Mock.Services.LogService(false); var pem = new PemService(); var csrPlugin = new Csr(log, pem, csrOptions); var target = csrPlugin.Generate().Result; Assert.IsNotNull(target); Assert.IsFalse(target is INull); Assert.IsTrue(target.Parts.Count() == 1); Assert.IsTrue(target.Parts.First().Identifiers.OfType <IpIdentifier>().Count() == 3); Assert.IsTrue(target.Parts.First().Identifiers.OfType <DnsIdentifier>().Count() == 2); Assert.IsTrue(target.Parts.First().Identifiers.OfType <EmailIdentifier>().Count() == 1); Assert.IsTrue(target.Parts.First().Identifiers.OfType <IpIdentifier>().Any(x => x.Value == "1.1.1.1")); Assert.IsTrue(target.Parts.First().Identifiers.OfType <DnsIdentifier>().Any(x => x.Value == "www.win-acme.com")); Assert.IsTrue(target.Parts.First().Identifiers.OfType <EmailIdentifier>().Any(x => x.Value == "*****@*****.**")); } finally { File.Delete(tempFile); } }
public PemFiles(ILogService log, PemService pemService, PemFilesOptions options) { _log = log; _pemService = pemService; if (!string.IsNullOrWhiteSpace(options.Path)) { _path = options.Path; } if (_path.ValidPath(log)) { _log.Debug("Using .pem certificate path: {_path}", _path); } else { throw new Exception("Error initializing PemFiles plugin, specified path is not valid."); } }
public PemFiles( ILogService log, ISettingsService settings, PemService pemService, PemFilesOptions options) { _log = log; _pemService = pemService; _path = !string.IsNullOrWhiteSpace(options.Path) ? options.Path : settings.Store.DefaultPemFilesPath; if (_path.ValidPath(log)) { _log.Debug("Using .pem certificate path: {_path}", _path); } else { throw new Exception($"Specified PemFiles path {_path} is not valid."); } }
public Csr(ILogService logService, PemService pemService, CsrOptions options) { _log = logService; _pem = pemService; _options = options; }
public Ec(ILogService log, PemService pemService, EcOptions options) : base(log, options) { _pemService = pemService; }