Skip to content

Commit

Permalink
Code format
Browse files Browse the repository at this point in the history
  • Loading branch information
Pro committed Sep 17, 2014
1 parent 184e9aa commit 0b84a0e
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions Src/Exchange.DkimSigner/DkimSigner.cs
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ private void loadSettings()
this.eligibleHeaders.Add("From");

Logger.LogInformation("Exchange DKIM settings loaded: " + config.SigningAlgorithm.ToString() + ", Canonicalization Header Algorithm: " + config.HeaderCanonicalization.ToString() + ", Canonicalization Body Algorithm: " + config.BodyCanonicalization.ToString() + ", Number of domains: " + validDomains.Count);

}

public void watchSettings()
Expand Down Expand Up @@ -318,11 +318,11 @@ private string GetBodyHash(Stream stream)
bodyText += temp;
}
}

// We have to ignore all empty lines at the end of the message body.
bodyText = Regex.Replace(bodyText, "(\r?\n)*$", string.Empty);
bodyText += "\r\n";

bodyBytes = Encoding.ASCII.GetBytes(bodyText);
hashText = Convert.ToBase64String(this.hashAlgorithm.ComputeHash(bodyBytes));
stream.Seek(0, SeekOrigin.Begin);
Expand Down Expand Up @@ -426,14 +426,14 @@ private IEnumerable<string> GetCanonicalizedHeaders(Stream stream)
if (beforeCount > 0)
{
//now remove them
header = header.Remove(firstPos-beforeCount,beforeCount);
header = header.Remove(firstPos - beforeCount, beforeCount);
}
// colon is now at another position
firstPos -= beforeCount;

//check how many whitespaces are after the colon
int afterCount = 0;
for (int i = firstPos + 1; i <header.Length; i++)
for (int i = firstPos + 1; i < header.Length; i++)
{
if (header[i] == ' ')
afterCount++;
Expand All @@ -443,7 +443,7 @@ private IEnumerable<string> GetCanonicalizedHeaders(Stream stream)
if (afterCount > 0)
{
//now remove them
header = header.Remove(firstPos + 1, afterCount);
header = header.Remove(firstPos + 1, afterCount);
}
}

Expand All @@ -459,7 +459,7 @@ private IEnumerable<string> GetCanonicalizedHeaders(Stream stream)
}

stream.Seek(0, SeekOrigin.Begin);

return headerNameToLineMap.Values.OrderBy(x => x, StringComparer.Ordinal);
}

Expand Down

0 comments on commit 0b84a0e

Please sign in to comment.