diff --git a/discovery.xml b/discovery.xml new file mode 100644 index 0000000..50ad730 --- /dev/null +++ b/discovery.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + diff --git a/proof-keys.xml b/proof-keys.xml new file mode 100644 index 0000000..71b94ea --- /dev/null +++ b/proof-keys.xml @@ -0,0 +1,5 @@ + + + BwIAAACkAABSU0EyAAQAAAEAAQCdu+YTwKD1hZFOmcEnFT8KJwmr+Zujnz5fSMGVhbx+FI2M9Lw3bP+K4TvjNC9CuW67AhbdLpzBGlcmvnGlIdSzEQKA7LPCA4LnJ5f6Yab2RkVBawgBYRvNNpcBeOzzTiKnaAIEsh3OqoSbM9YgydAHLLEkOWc7/PLKHS1EcAJv0Rud54qWuj7aTwv7pq+mAu80Q4c/c8813pOKu4pqJY2sieDb6NIR8mkI5fT3/XNtdf4kQA3NMOYufXdudX1sotinrSzjnel6dbwvNBYeLq711ZDHPJ0pgACGTqqBNGJimTHvaKfmrMLJOv5SxE2Q91MPGcaRxKkYlLJbk9mFnH337xysw2ZZVIu00xVunhgPUh4qcyVOLvdcoH78era3cGj4YHALkr6sTf4EHluk9+ECUMLb0L6QOJW/gBAej1MmiWn29hFr8Zs1lkpwTplvHm76YFQsyq2HGoDoUM8GrsvT+Ty3rDTWo8x8z0a1tFO4RF6kwLdV42PqjXJjNP2MXz167GRD5odykEqISlE2igYwIZpu8hV5n09Q8zzjFPaIJA1aciq1WMZP2mWnLp3rO8CSIQiZM7CQo7cwfCcF9U0+SfZIQI8mmQFT7uifsscI2Gs6udabDB1kAn3wumX9JD/vKhYakcJGfLtzmE9oWF+huWg4gSiKZff/zbvV6066yYO2f3INvQ7rGdqvzUOUSrx3aG9Ex/u8JiIvhm7SlsQ+bifAKsZxnYEm1lHjmpstORxkn/5fWKoTCuKzpP/4g8w= + BwIAAACkAABSU0EyAAQAAAEAAQABRJHMlsxTIVj3qONMyeHflswnGmw/kI4Kiwuxk5HJPVwdixhAv/W8D7giYdoH+TQmMLU5THeZU7j88KQ7tDr3YXgwRFVVE23LdCLa/LVQg2Xhng2L61Q5xMknxCs/oNKZ99ymysbnAmNFz+QcIpMPpxEBEpWm6ASirieuWwNatqu8vn3aiNNO0EqxjOj4wFTXTbtq/fJXhP50n8Wwv6YfPenlijdKmPEAaPt+HpczuLFlBvoGrhTJAYHN4DBfOeQDKiO3XAYBn3zVzWrHoOaUNdk3BWjaPp2JqcVojZxjtbJkQsRRP5Q1A6Xfhu077xFecsR+B8AtpfUiLgMUbIvMwbiCwZSG27V9448karwo9pCPXSWLXufd93EgtETuH0eYMbBSVsnQjnJ7mHIM+f43tLTdUAE744WHbVNNOeaxCW/QsvwKUd7CI5UNfVRwCtuqvaFWYqJ9X7wmYyy39Lke7V9qLraQx47Ww9FE3BQlxhvyZgSb8f93iMemLH7yI7f064Nj1XKGeKuK88XPigwgbO9lFQweOtxygxABBCcWD5TdAr7G39K95RNpB00qRDwxGUZQKI7XAJ+whOZT+9vghXhJaYQ4ap0m5jqAk5OLS+X0D381mL0clLiqXCISbCkGMtNYkds+PWxq/MwpfVN7D883ezM1LKl7T8KSIU22Iy3mk6LSV7PRa8OTLzdnSUyL2PgEuYS5LDQvnQPT6u41sYIZd0gnUMZZ4UKlpKSmnNpghgK8e/T0/6v0/7vIjjs= + \ No newline at end of file diff --git a/src/WopiValidator/Program.cs b/src/WopiValidator/Program.cs index f879939..08d2523 100644 --- a/src/WopiValidator/Program.cs +++ b/src/WopiValidator/Program.cs @@ -9,7 +9,9 @@ using System.Globalization; using System.Linq; using System.Net; +using System.Security.Cryptography; using System.Text; +using System.Xml.Linq; namespace Microsoft.Office.WopiValidator { @@ -21,7 +23,7 @@ internal enum ExitCode internal class Program { - private static TestCaseExecutor GetTestCaseExecutor(TestExecutionData testExecutionData, Options options, TestCategory inputTestCategory) + private static TestCaseExecutor GetTestCaseExecutor(TestExecutionData testExecutionData, Options options, TestCategory inputTestCategory, RSACryptoServiceProvider proofKeyProviderNew, RSACryptoServiceProvider proofKeyProviderOld) { TestCategory testCategory; if (!Enum.TryParse(testExecutionData.TestCase.Category, true /* ignoreCase */, out testCategory)) @@ -31,7 +33,7 @@ private static TestCaseExecutor GetTestCaseExecutor(TestExecutionData testExecut string userAgent = (inputTestCategory == TestCategory.OfficeNativeClient || testCategory == TestCategory.OfficeNativeClient) ? Constants.HeaderValues.OfficeNativeClientUserAgent : null; - return new TestCaseExecutor(testExecutionData, options.WopiEndpoint, options.AccessToken, options.AccessTokenTtl, userAgent); + return new TestCaseExecutor(testExecutionData, options.WopiEndpoint, options.AccessToken, options.AccessTokenTtl, userAgent, proofKeyProviderNew, proofKeyProviderOld); } private static int Main(string[] args) @@ -62,6 +64,17 @@ private static int Main(string[] args) private static ExitCode Execute(Options options) { + RSACryptoServiceProvider proofKeyProviderNew = null; + RSACryptoServiceProvider proofKeyProviderOld = null; + + const string proofKeysFilePath = "proof-keys.xml"; + if (System.IO.File.Exists(proofKeysFilePath)) + { + var proofKeyData = XDocument.Load(proofKeysFilePath); + proofKeyProviderNew = CreateProofCSP(proofKeyData, "new"); + proofKeyProviderOld = CreateProofCSP(proofKeyData, "old"); + } + // get run configuration from XML IEnumerable testData = ConfigParser.ParseExecutionData(options.RunConfigurationFilePath, options.TestCategory); @@ -85,7 +98,7 @@ private static ExitCode Execute(Options options) .Select(g => new { Name = g.Key, - Executors = g.Select(x => GetTestCaseExecutor(x, options, options.TestCategory)) + Executors = g.Select(x => GetTestCaseExecutor(x, options, options.TestCategory, proofKeyProviderNew, proofKeyProviderOld)) }); ConsoleColor baseColor = ConsoleColor.White; @@ -166,6 +179,14 @@ private static ExitCode Execute(Options options) return ExitCode.Success; } + private static RSACryptoServiceProvider CreateProofCSP(XDocument proofKeyData, string name) + { + var key = proofKeyData.Root.Element(name).Value; + var csp = new RSACryptoServiceProvider(); + csp.ImportCspBlob(Convert.FromBase64String(key)); + return csp; + } + private static void WriteToConsole(string message, ConsoleColor color, int indentLevel = 0) { ConsoleColor currentColor = Console.ForegroundColor;