Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add dummy proof keys and discovery XML #86

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions discovery.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<wopi-discovery>
<net-zone name="external-https">
<app name="WopiTest" favIconUrl="https://FFC-onenote.officeapps.live.com" checkLicense="true">
<action name="view" ext="wopitest" urlsrc="https://FFC-onenote.officeapps.live.com/hosting/WopiTestFrame.aspx?&lt;ui=UI_LLCC&amp;&gt;&lt;rs=DC_LLCC&amp;&gt;&lt;dchat=DISABLE_CHAT&amp;&gt;&lt;hid=HOST_SESSION_ID&amp;&gt;&lt;sc=SESSION_CONTEXT&amp;&gt;&lt;wopisrc=WOPI_SOURCE&amp;&gt;&lt;IsLicensedUser=BUSINESS_USER&amp;&gt;&lt;testcategory=VALIDATOR_TEST_CATEGORY&gt;" />
<action name="view" ext="wopitestx" urlsrc="https://FFC-onenote.officeapps.live.com/hosting/WopiTestFrame.aspx?&lt;ui=UI_LLCC&amp;&gt;&lt;rs=DC_LLCC&amp;&gt;&lt;dchat=DISABLE_CHAT&amp;&gt;&lt;hid=HOST_SESSION_ID&amp;&gt;&lt;sc=SESSION_CONTEXT&amp;&gt;&lt;wopisrc=WOPI_SOURCE&amp;&gt;&lt;IsLicensedUser=BUSINESS_USER&amp;&gt;&lt;testcategory=VALIDATOR_TEST_CATEGORY&gt;" />
<action name="edit" ext="wopitest" urlsrc="https://FFC-onenote.officeapps.live.com/hosting/WopiTestFrame.aspx?&lt;ui=UI_LLCC&amp;&gt;&lt;rs=DC_LLCC&amp;&gt;&lt;dchat=DISABLE_CHAT&amp;&gt;&lt;hid=HOST_SESSION_ID&amp;&gt;&lt;sc=SESSION_CONTEXT&amp;&gt;&lt;wopisrc=WOPI_SOURCE&amp;&gt;&lt;IsLicensedUser=BUSINESS_USER&amp;&gt;&lt;testcategory=VALIDATOR_TEST_CATEGORY&gt;" />
<action name="edit" ext="wopitestx" urlsrc="https://FFC-onenote.officeapps.live.com/hosting/WopiTestFrame.aspx?&lt;ui=UI_LLCC&amp;&gt;&lt;rs=DC_LLCC&amp;&gt;&lt;dchat=DISABLE_CHAT&amp;&gt;&lt;hid=HOST_SESSION_ID&amp;&gt;&lt;sc=SESSION_CONTEXT&amp;&gt;&lt;wopisrc=WOPI_SOURCE&amp;&gt;&lt;IsLicensedUser=BUSINESS_USER&amp;&gt;&lt;testcategory=VALIDATOR_TEST_CATEGORY&gt;" />
<action name="getinfo" ext="wopitest" urlsrc="https://FFC-onenote.officeapps.live.com/hosting/GetWopiTestInfo.ashx?&lt;ui=UI_LLCC&amp;&gt;&lt;rs=DC_LLCC&amp;&gt;&lt;dchat=DISABLE_CHAT&amp;&gt;&lt;hid=HOST_SESSION_ID&amp;&gt;&lt;sc=SESSION_CONTEXT&amp;&gt;&lt;wopisrc=WOPI_SOURCE&amp;&gt;&lt;IsLicensedUser=BUSINESS_USER&amp;&gt;&lt;testcategory=VALIDATOR_TEST_CATEGORY&gt;" />
<action name="getinfo" ext="wopitestx" urlsrc="https://FFC-onenote.officeapps.live.com/hosting/GetWopiTestInfo.ashx?&lt;ui=UI_LLCC&amp;&gt;&lt;rs=DC_LLCC&amp;&gt;&lt;dchat=DISABLE_CHAT&amp;&gt;&lt;hid=HOST_SESSION_ID&amp;&gt;&lt;sc=SESSION_CONTEXT&amp;&gt;&lt;wopisrc=WOPI_SOURCE&amp;&gt;&lt;IsLicensedUser=BUSINESS_USER&amp;&gt;&lt;testcategory=VALIDATOR_TEST_CATEGORY&gt;" />
<action name="open" ext="wopitest" urlsrc="https://FFC-onenote.officeapps.live.com/hosting/WopiTestFrame.aspx?&lt;ui=UI_LLCC&amp;&gt;&lt;rs=DC_LLCC&amp;&gt;&lt;dchat=DISABLE_CHAT&amp;&gt;&lt;hid=HOST_SESSION_ID&amp;&gt;&lt;sc=SESSION_CONTEXT&amp;&gt;&lt;wopisrc=WOPI_SOURCE&amp;&gt;&lt;IsLicensedUser=BUSINESS_USER&amp;&gt;&lt;testcategory=VALIDATOR_TEST_CATEGORY&gt;" />
<action name="open" ext="wopitestx" urlsrc="https://FFC-onenote.officeapps.live.com/hosting/WopiTestFrame.aspx?&lt;ui=UI_LLCC&amp;&gt;&lt;rs=DC_LLCC&amp;&gt;&lt;dchat=DISABLE_CHAT&amp;&gt;&lt;hid=HOST_SESSION_ID&amp;&gt;&lt;sc=SESSION_CONTEXT&amp;&gt;&lt;wopisrc=WOPI_SOURCE&amp;&gt;&lt;IsLicensedUser=BUSINESS_USER&amp;&gt;&lt;testcategory=VALIDATOR_TEST_CATEGORY&gt;" />
</app>
</net-zone>
<proof-key value="BgIAAACkAABSU0ExAAQAAAEAAQABRJHMlsxTIVj3qONMyeHflswnGmw/kI4Kiwuxk5HJPVwdixhAv/W8D7giYdoH+TQmMLU5THeZU7j88KQ7tDr3YXgwRFVVE23LdCLa/LVQg2Xhng2L61Q5xMknxCs/oNKZ99ymysbnAmNFz+QcIpMPpxEBEpWm6ASirieuWwNatg=="
exponent="AQAB"
modulus="tloDW64nrqIE6KaVEgERpw+TIhzkz0VjAufGyqbc95nSoD8rxCfJxDlU64sNnuFlg1C1/NoidMttE1VVRDB4Yfc6tDuk8Py4U5l3TDm1MCY0+QfaYSK4D7z1v0AYix1cPcmRk7ELiwqOkD9sGifMlt/hyUzjqPdYIVPMlsyRRAE="
oldvalue="BgIAAACkAABSU0ExAAQAAAEAAQCdu+YTwKD1hZFOmcEnFT8KJwmr+Zujnz5fSMGVhbx+FI2M9Lw3bP+K4TvjNC9CuW67AhbdLpzBGlcmvnGlIdSzEQKA7LPCA4LnJ5f6Yab2RkVBawgBYRvNNpcBeOzzTiKnaAIEsh3OqoSbM9YgydAHLLEkOWc7/PLKHS1EcAJv0Q=="
oldexponent="AQAB"
oldmodulus="0W8CcEQtHcry/DtnOSSxLAfQySDWM5uEqs4dsgQCaKciTvPseAGXNs0bYQEIa0FFRvamYfqXJ+eCA8Kz7IACEbPUIaVxviZXGsGcLt0WArtuuUIvNOM74Yr/bDe89IyNFH68hZXBSF8+n6Ob+asJJwo/FSfBmU6RhfWgwBPmu50=" />
</wopi-discovery>
5 changes: 5 additions & 0 deletions proof-keys.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<keys>
<old>BwIAAACkAABSU0EyAAQAAAEAAQCdu+YTwKD1hZFOmcEnFT8KJwmr+Zujnz5fSMGVhbx+FI2M9Lw3bP+K4TvjNC9CuW67AhbdLpzBGlcmvnGlIdSzEQKA7LPCA4LnJ5f6Yab2RkVBawgBYRvNNpcBeOzzTiKnaAIEsh3OqoSbM9YgydAHLLEkOWc7/PLKHS1EcAJv0Rud54qWuj7aTwv7pq+mAu80Q4c/c8813pOKu4pqJY2sieDb6NIR8mkI5fT3/XNtdf4kQA3NMOYufXdudX1sotinrSzjnel6dbwvNBYeLq711ZDHPJ0pgACGTqqBNGJimTHvaKfmrMLJOv5SxE2Q91MPGcaRxKkYlLJbk9mFnH337xysw2ZZVIu00xVunhgPUh4qcyVOLvdcoH78era3cGj4YHALkr6sTf4EHluk9+ECUMLb0L6QOJW/gBAej1MmiWn29hFr8Zs1lkpwTplvHm76YFQsyq2HGoDoUM8GrsvT+Ty3rDTWo8x8z0a1tFO4RF6kwLdV42PqjXJjNP2MXz167GRD5odykEqISlE2igYwIZpu8hV5n09Q8zzjFPaIJA1aciq1WMZP2mWnLp3rO8CSIQiZM7CQo7cwfCcF9U0+SfZIQI8mmQFT7uifsscI2Gs6udabDB1kAn3wumX9JD/vKhYakcJGfLtzmE9oWF+huWg4gSiKZff/zbvV6066yYO2f3INvQ7rGdqvzUOUSrx3aG9Ex/u8JiIvhm7SlsQ+bifAKsZxnYEm1lHjmpstORxkn/5fWKoTCuKzpP/4g8w=</old>
<new>BwIAAACkAABSU0EyAAQAAAEAAQABRJHMlsxTIVj3qONMyeHflswnGmw/kI4Kiwuxk5HJPVwdixhAv/W8D7giYdoH+TQmMLU5THeZU7j88KQ7tDr3YXgwRFVVE23LdCLa/LVQg2Xhng2L61Q5xMknxCs/oNKZ99ymysbnAmNFz+QcIpMPpxEBEpWm6ASirieuWwNatqu8vn3aiNNO0EqxjOj4wFTXTbtq/fJXhP50n8Wwv6YfPenlijdKmPEAaPt+HpczuLFlBvoGrhTJAYHN4DBfOeQDKiO3XAYBn3zVzWrHoOaUNdk3BWjaPp2JqcVojZxjtbJkQsRRP5Q1A6Xfhu077xFecsR+B8AtpfUiLgMUbIvMwbiCwZSG27V9448karwo9pCPXSWLXufd93EgtETuH0eYMbBSVsnQjnJ7mHIM+f43tLTdUAE744WHbVNNOeaxCW/QsvwKUd7CI5UNfVRwCtuqvaFWYqJ9X7wmYyy39Lke7V9qLraQx47Ww9FE3BQlxhvyZgSb8f93iMemLH7yI7f064Nj1XKGeKuK88XPigwgbO9lFQweOtxygxABBCcWD5TdAr7G39K95RNpB00qRDwxGUZQKI7XAJ+whOZT+9vghXhJaYQ4ap0m5jqAk5OLS+X0D381mL0clLiqXCISbCkGMtNYkds+PWxq/MwpfVN7D883ezM1LKl7T8KSIU22Iy3mk6LSV7PRa8OTLzdnSUyL2PgEuYS5LDQvnQPT6u41sYIZd0gnUMZZ4UKlpKSmnNpghgK8e/T0/6v0/7vIjjs=</new>
</keys>
27 changes: 24 additions & 3 deletions src/WopiValidator/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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))
Expand All @@ -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)
Expand Down Expand Up @@ -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<TestExecutionData> testData = ConfigParser.ParseExecutionData(options.RunConfigurationFilePath, options.TestCategory);

Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down