/// <summary> /// Initializes a new instance of the <see cref="DkimSigningRoutingAgent"/> class. /// </summary> /// <param name="dkimSigner">The object that knows how to sign messages.</param> public DkimSigningRoutingAgent() { Logger.LogDebug("Initializing DkimSigner"); Settings config = new Settings(); config.InitHeadersToSign(); this.dkimSigner = new DkimSigner(); this.LoadSettings(); this.WatchSettings(); this.OnCategorizedMessage += this.WhenMessageCategorized; Logger.LogDebug("DkimSigner initiallized"); }
private void LoadSettings() { Settings config = new Settings(); config.InitHeadersToSign(); if(config.Load(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "settings.xml"))) { this.dkimSigner.UpdateSettings(config); Logger.logLevel = config.Loglevel; Logger.LogInformation("Exchange DKIM settings loaded: " + config.SigningAlgorithm.ToString() + ", Canonicalization Header Algorithm: " + config.HeaderCanonicalization.ToString() + ", Canonicalization Body Algorithm: " + config.BodyCanonicalization.ToString() + ", Number of domains: " + this.dkimSigner.GetDomains().Count); } else { Logger.LogError("Couldn't load the settings file.\n"); } }
public void TestInitHeadersToSign() { Settings config = new Settings(); config.InitHeadersToSign(); Assert.AreEqual(new string[] { "From", "Subject", "To", "Date", "Message-ID" }, config.HeadersToSign); }