From ec0428607d0aaa609fde94bd82c3fd5215fc2de7 Mon Sep 17 00:00:00 2001 From: Jan Jahoda Date: Fri, 12 Mar 2021 12:32:20 +0100 Subject: [PATCH 1/5] Credscan second round --- .../System/Net/Configuration.Certificates.cs | 4 +- .../Common/DbConnectionStringBuilderTest.cs | 58 +++---- .../TDS/TDS.Servers/TDSServerArguments.cs | 2 +- .../TDS/TDS.Servers/TdsServerCertificate.pfx | Bin 1854 -> 1661 bytes .../UnitTests/HttpEnvironmentProxyTest.cs | 6 +- .../tests/ConnectTest.cs | 2 +- .../FunctionalTests/UriBuilderRefreshTest.cs | 2 +- .../tests/FunctionalTests/UriBuilderTests.cs | 2 +- .../UriRelativeResolutionTest.cs | 22 +-- .../tests/System/Uri.CreateStringTests.cs | 2 +- .../tests/Rfc2898Tests.cs | 22 +-- .../tests/ExportTests.cs | 6 +- .../tests/EncryptedXmlTest.cs | 6 +- .../tests/SignedXmlTest.cs | 162 +++--------------- .../tests/TestHelpers.cs | 4 +- 15 files changed, 95 insertions(+), 205 deletions(-) diff --git a/src/Common/tests/System/Net/Configuration.Certificates.cs b/src/Common/tests/System/Net/Configuration.Certificates.cs index 340792634202..dbe69c51d223 100644 --- a/src/Common/tests/System/Net/Configuration.Certificates.cs +++ b/src/Common/tests/System/Net/Configuration.Certificates.cs @@ -16,8 +16,8 @@ public static partial class Configuration { public static partial class Certificates { - private const string CertificatePassword = "testcertificate"; - private const string TestDataFolder = "TestData"; + private const string CertificatePassword = "PLACEHOLDER"; + private const string TestDataFolder = "TestDataCertificates"; private static readonly Mutex m; private const int MutexTimeout = 120 * 1000; diff --git a/src/System.Data.Common/tests/System/Data/Common/DbConnectionStringBuilderTest.cs b/src/System.Data.Common/tests/System/Data/Common/DbConnectionStringBuilderTest.cs index a703b498eb56..717a122452a4 100644 --- a/src/System.Data.Common/tests/System/Data/Common/DbConnectionStringBuilderTest.cs +++ b/src/System.Data.Common/tests/System/Data/Common/DbConnectionStringBuilderTest.cs @@ -1867,12 +1867,12 @@ public void EmbeddedCharTest1() sb["Data Source"] = "testdb"; sb["User ID"] = "someuser"; - sb["Password"] = "abcdef"; - Assert.Equal("Data Source=testdb;User ID=someuser;Password=abcdef", + sb["Password"] = "PLACEHOLDER"; + Assert.Equal("Data Source=testdb;User ID=someuser;Password=PLACEHOLDER", sb.ConnectionString); - sb["Password"] = "abcdef#"; - Assert.Equal("Data Source=testdb;User ID=someuser;Password=abcdef#", + sb["Password"] = "PLACEHOLDER#"; + Assert.Equal("Data Source=testdb;User ID=someuser;Password=PLACEHOLDER#", sb.ConnectionString); // an embedded single-quote value will result in the value being delimieted with double quotes @@ -1893,39 +1893,39 @@ public void EmbeddedCharTest1() sb.ConnectionString); sb = new DbConnectionStringBuilder(); - sb["PASSWORD"] = "abcdef1"; + sb["PASSWORD"] = "PLACEHOLDERabcdef1"; sb["user id"] = "someuser"; sb["Data Source"] = "testdb"; - Assert.Equal("PASSWORD=abcdef1;user id=someuser;Data Source=testdb", + Assert.Equal("PASSWORD=PLACEHOLDERabcdef1;user id=someuser;Data Source=testdb", sb.ConnectionString); // case is preserved for a keyword that was added the first time sb = new DbConnectionStringBuilder(); - sb["PassWord"] = "abcdef2"; + sb["PassWord"] = "PLACEHOLDERabcdef2"; sb["uSER iD"] = "someuser"; sb["DaTa SoUrCe"] = "testdb"; - Assert.Equal("PassWord=abcdef2;uSER iD=someuser;DaTa SoUrCe=testdb", + Assert.Equal("PassWord=PLACEHOLDERabcdef2;uSER iD=someuser;DaTa SoUrCe=testdb", sb.ConnectionString); - sb["passWORD"] = "abc123"; - Assert.Equal("PassWord=abc123;uSER iD=someuser;DaTa SoUrCe=testdb", + sb["passWORD"] = "PLACEHOLDERabc123"; + Assert.Equal("PassWord=PLACEHOLDERabc123;uSER iD=someuser;DaTa SoUrCe=testdb", sb.ConnectionString); // embedded equal sign in the value will cause the value to be // delimited with double-quotes sb = new DbConnectionStringBuilder(); - sb["Password"] = "abc=def"; + sb["Password"] = "PLACEHOLDER=def"; sb["Data Source"] = "testdb"; sb["User ID"] = "someuser"; - Assert.Equal("Password=\"abc=def\";Data Source=testdb;User ID=someuser", + Assert.Equal("Password=\"PLACEHOLDER=def\";Data Source=testdb;User ID=someuser", sb.ConnectionString); // embedded semicolon in the value will cause the value to be // delimited with double-quotes sb = new DbConnectionStringBuilder(); - sb["Password"] = "abc;def"; + sb["Password"] = "PLACEHOLDER;def"; sb["Data Source"] = "testdb"; sb["User ID"] = "someuser"; - Assert.Equal("Password=\"abc;def\";Data Source=testdb;User ID=someuser", + Assert.Equal("Password=\"PLACEHOLDER;def\";Data Source=testdb;User ID=someuser", sb.ConnectionString); // more right parentheses then left parentheses - happily takes it @@ -2042,32 +2042,32 @@ public void EmbeddedCharTest3() DbConnectionStringBuilder sb; sb = new DbConnectionStringBuilder(); - sb.ConnectionString = "User ID=SCOTT;Password=TiGeR;Data Source=" + dataSource; + sb.ConnectionString = "User ID=SCOTT;Password=PLACEHOLDER;Data Source=" + dataSource; Assert.Equal(dataSource, sb["Data Source"]); Assert.Equal("SCOTT", sb["User ID"]); - Assert.Equal("TiGeR", sb["Password"]); + Assert.Equal("PLACEHOLDER", sb["Password"]); Assert.Equal( - "user id=SCOTT;password=TiGeR;data source=\"(DESCRIPTION=(ADDRESS=(PROTOCOL=" + + "user id=SCOTT;password=PLACEHOLDER;data source=\"(DESCRIPTION=(ADDRESS=(PROTOCOL=" + "TCP)(HOST=192.168.1.101)(PORT=1521))(CONNECT_DATA=(SERVER=DEDICATED)" + "(SERVICE_NAME=TESTDB)))\"", sb.ConnectionString); sb = new DbConnectionStringBuilder(false); - sb.ConnectionString = "User ID=SCOTT;Password=TiGeR;Data Source=" + dataSource; + sb.ConnectionString = "User ID=SCOTT;Password=PLACEHOLDER;Data Source=" + dataSource; Assert.Equal(dataSource, sb["Data Source"]); Assert.Equal("SCOTT", sb["User ID"]); - Assert.Equal("TiGeR", sb["Password"]); + Assert.Equal("PLACEHOLDER", sb["Password"]); Assert.Equal( - "user id=SCOTT;password=TiGeR;data source=\"(DESCRIPTION=(ADDRESS=(PROTOCOL=" + + "user id=SCOTT;password=PLACEHOLDER;data source=\"(DESCRIPTION=(ADDRESS=(PROTOCOL=" + "TCP)(HOST=192.168.1.101)(PORT=1521))(CONNECT_DATA=(SERVER=DEDICATED)" + "(SERVICE_NAME=TESTDB)))\"", sb.ConnectionString); sb = new DbConnectionStringBuilder(true); - sb.ConnectionString = "User ID=SCOTT;Password=TiGeR;Data Source=" + dataSource; + sb.ConnectionString = "User ID=SCOTT;Password=PLACEHOLDER;Data Source=" + dataSource; Assert.Equal(dataSource, sb["Data Source"]); Assert.Equal("SCOTT", sb["User ID"]); - Assert.Equal("TiGeR", sb["Password"]); + Assert.Equal("PLACEHOLDER", sb["Password"]); Assert.Equal( - "user id=SCOTT;password=TiGeR;data source=(DESCRIPTION=(ADDRESS=(PROTOCOL=" + + "user id=SCOTT;password=PLACEHOLDER;data source=(DESCRIPTION=(ADDRESS=(PROTOCOL=" + "TCP)(HOST=192.168.1.101)(PORT=1521))(CONNECT_DATA=(SERVER=DEDICATED)" + "(SERVICE_NAME=TESTDB)))", sb.ConnectionString); } @@ -2078,24 +2078,24 @@ public void EmbeddedCharTest4() DbConnectionStringBuilder sb; sb = new DbConnectionStringBuilder(); - sb.ConnectionString = "PassWord=abcdef2;uSER iD=someuser;DaTa SoUrCe=testdb"; + sb.ConnectionString = "PassWord=PLACEHOLDER;uSER iD=someuser;DaTa SoUrCe=testdb"; sb["Integrated Security"] = "False"; Assert.Equal( - "password=abcdef2;user id=someuser;data source=testdb;Integrated Security=False", + "password=PLACEHOLDER;user id=someuser;data source=testdb;Integrated Security=False", sb.ConnectionString); sb = new DbConnectionStringBuilder(false); - sb.ConnectionString = "PassWord=abcdef2;uSER iD=someuser;DaTa SoUrCe=testdb"; + sb.ConnectionString = "PassWord=PLACEHOLDER;uSER iD=someuser;DaTa SoUrCe=testdb"; sb["Integrated Security"] = "False"; Assert.Equal( - "password=abcdef2;user id=someuser;data source=testdb;Integrated Security=False", + "password=PLACEHOLDER;user id=someuser;data source=testdb;Integrated Security=False", sb.ConnectionString); sb = new DbConnectionStringBuilder(true); - sb.ConnectionString = "PassWord=abcdef2;uSER iD=someuser;DaTa SoUrCe=testdb"; + sb.ConnectionString = "PassWord=PLACEHOLDER;uSER iD=someuser;DaTa SoUrCe=testdb"; sb["Integrated Security"] = "False"; Assert.Equal( - "password=abcdef2;user id=someuser;data source=testdb;Integrated Security=False", + "password=PLACEHOLDER;user id=someuser;data source=testdb;Integrated Security=False", sb.ConnectionString); } diff --git a/src/System.Data.SqlClient/tests/Tools/TDS/TDS.Servers/TDSServerArguments.cs b/src/System.Data.SqlClient/tests/Tools/TDS/TDS.Servers/TDSServerArguments.cs index d47f45a8ee11..25fb64576c0a 100644 --- a/src/System.Data.SqlClient/tests/Tools/TDS/TDS.Servers/TDSServerArguments.cs +++ b/src/System.Data.SqlClient/tests/Tools/TDS/TDS.Servers/TDSServerArguments.cs @@ -88,7 +88,7 @@ public TDSServerArguments() // By Default SQL authentication will be used. FedAuthRequiredPreLoginOption = TdsPreLoginFedAuthRequiredOption.FedAuthNotRequired; - EncryptionCertificate = new X509Certificate2("TdsServerCertificate.pfx", "SecretPassword123456"); + EncryptionCertificate = new X509Certificate2("TdsServerCertificate.pfx", "PLACEHOLDER"); ServerPrincipalName = AzureADServicePrincipalName; StsUrl = AzureADProductionTokenEndpoint; diff --git a/src/System.Data.SqlClient/tests/Tools/TDS/TDS.Servers/TdsServerCertificate.pfx b/src/System.Data.SqlClient/tests/Tools/TDS/TDS.Servers/TdsServerCertificate.pfx index a5c48e2aee1f100c63aa698345667d6a3672e97f..8d4afef7d2a01b8d4b3aaa16f81998ee327e0159 100644 GIT binary patch literal 1661 zcmV-@27>u8f(Cg40Ru3C20sP~Duzgg_YDCD0ic2gFa&}IEHHuwC@_KpCk6>BhDe6@ z4FLxRpn?M!FoFXV0s#Opf&&c(2`Yw2hW8Bt2LUh~1_~;MNQUCCkvV=?(Q@dV{0KMM&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gJ!Xd)d#`P_q%TZ}<3tO*OPjijp?7oCb*)3;h?e zd3z`Prbi?EotNxMC&lc3FqfXu*zCNtY~X!-x9jyYg_vPSg!5casVTAb6jHvzF=jhI zFi@0eUB2nAsQRf88rZY{mFgH< zS4t;hEcjMg?ZkbO==2K8F%wQ`IbfbUbK#<2HAU9wX~lmuG43P#$|<2t3)Gaph3EE<$>?RP_hgkFi|I#?*6QO?0=?zXh|3?%c=Y12H9OkbFI9%p~;IC&8TakZJmP6$ttsQiU+!p2Jcoq%vC0KPfX@FkZ>t o!*E%YHj&r!WPX!~mNWW@t668IJ&=o1TUT#dU>6Bv^S&D54}-)jG5`Po diff --git a/src/System.Net.Http/tests/UnitTests/HttpEnvironmentProxyTest.cs b/src/System.Net.Http/tests/UnitTests/HttpEnvironmentProxyTest.cs index 34a555f9ae28..063c70fba0d6 100644 --- a/src/System.Net.Http/tests/UnitTests/HttpEnvironmentProxyTest.cs +++ b/src/System.Net.Http/tests/UnitTests/HttpEnvironmentProxyTest.cs @@ -158,7 +158,7 @@ public void HttpProxy_CredentialParsing_Basic() { IWebProxy p; - Environment.SetEnvironmentVariable("all_proxy", "http://foo:bar@1.1.1.1:3000"); + Environment.SetEnvironmentVariable("all_proxy", "http://foo:PLACEHOLDER@1.1.1.1:3000"); Assert.True(HttpEnvironmentProxy.TryCreate(out p)); Assert.NotNull(p); Assert.NotNull(p.Credentials); @@ -170,7 +170,7 @@ public void HttpProxy_CredentialParsing_Basic() Assert.NotNull(p.Credentials); // Use different user for http and https - Environment.SetEnvironmentVariable("https_proxy", "http://foo1:bar1@1.1.1.1:3000"); + Environment.SetEnvironmentVariable("https_proxy", "http://foo1:PLACEHOLDER@1.1.1.1:3000"); Assert.True(HttpEnvironmentProxy.TryCreate(out p)); Assert.NotNull(p); Uri u = p.GetProxy(fooHttp); @@ -193,7 +193,7 @@ public void HttpProxy_Exceptions_Match() IWebProxy p; Environment.SetEnvironmentVariable("no_proxy", ".test.com,, foo.com"); - Environment.SetEnvironmentVariable("all_proxy", "http://foo:bar@1.1.1.1:3000"); + Environment.SetEnvironmentVariable("all_proxy", "http://foo:PLACEHOLDER@1.1.1.1:3000"); Assert.True(HttpEnvironmentProxy.TryCreate(out p)); Assert.NotNull(p); diff --git a/src/System.Net.WebSockets.Client/tests/ConnectTest.cs b/src/System.Net.WebSockets.Client/tests/ConnectTest.cs index c12a0ab7c924..64988e894bf9 100644 --- a/src/System.Net.WebSockets.Client/tests/ConnectTest.cs +++ b/src/System.Net.WebSockets.Client/tests/ConnectTest.cs @@ -230,7 +230,7 @@ await LoopbackServer.CreateClientAndServerAsync(async uri => using (var clientSocket = new ClientWebSocket()) using (var cts = new CancellationTokenSource(TimeOutMilliseconds)) { - clientSocket.Options.SetRequestHeader("Authorization", "AWS4-HMAC-SHA256 Credential= AKIAXXXXXXXXXXXYSZA /20190301/us-east-2/neptune-db/aws4_request, SignedHeaders=host;x-amz-date, Signature=b8155de54d9faab00000000000000000000000000a07e0d7dda49902e4d9202"); + clientSocket.Options.SetRequestHeader("Authorization", "AWS4-HMAC-SHA256 Credential=PLACEHOLDER /20190301/us-east-2/neptune-db/aws4_request, SignedHeaders=host;x-amz-date, Signature=b8155de54d9faab00000000000000000000000000a07e0d7dda49902e4d9202"); await clientSocket.ConnectAsync(uri, cts.Token); } }, server => server.AcceptConnectionAsync(async connection => diff --git a/src/System.Private.Uri/tests/FunctionalTests/UriBuilderRefreshTest.cs b/src/System.Private.Uri/tests/FunctionalTests/UriBuilderRefreshTest.cs index 5297577ff3e4..684f03286c82 100644 --- a/src/System.Private.Uri/tests/FunctionalTests/UriBuilderRefreshTest.cs +++ b/src/System.Private.Uri/tests/FunctionalTests/UriBuilderRefreshTest.cs @@ -8,7 +8,7 @@ namespace System.PrivateUri.Tests { public class UriBuilderRefreshTest { - private static Uri s_starterUri = new Uri("http://user:psw@host:9090/path/file.txt?query#fragment"); + private static Uri s_starterUri = new Uri("http://user:PLACEHOLDER@host:9090/path/file.txt?query#fragment"); [Fact] public void UriBuilder_ChangeScheme_Refreshed() diff --git a/src/System.Private.Uri/tests/FunctionalTests/UriBuilderTests.cs b/src/System.Private.Uri/tests/FunctionalTests/UriBuilderTests.cs index 31835a660234..510900f4fc34 100644 --- a/src/System.Private.Uri/tests/FunctionalTests/UriBuilderTests.cs +++ b/src/System.Private.Uri/tests/FunctionalTests/UriBuilderTests.cs @@ -217,7 +217,7 @@ public void UserName_Get_Set(string value, string expected) [InlineData(null, "")] public void Password_Get_Set(string value, string expected) { - var uriBuilder = new UriBuilder("http://userinfo1:userinfo2@domain/path?query#fragment"); + var uriBuilder = new UriBuilder("http://userinfo1:PLACEHOLDER@domain/path?query#fragment"); uriBuilder.Password = value; Assert.Equal(expected, uriBuilder.Password); diff --git a/src/System.Private.Uri/tests/FunctionalTests/UriRelativeResolutionTest.cs b/src/System.Private.Uri/tests/FunctionalTests/UriRelativeResolutionTest.cs index 12a9b2ac3f04..c8bd2a272202 100644 --- a/src/System.Private.Uri/tests/FunctionalTests/UriRelativeResolutionTest.cs +++ b/src/System.Private.Uri/tests/FunctionalTests/UriRelativeResolutionTest.cs @@ -17,10 +17,10 @@ public class UriRelativeResolutionTest { // See RFC 3986 Section 5.2.2 and 5.4 http://www.ietf.org/rfc/rfc3986.txt - private readonly Uri _fullBaseUri = new Uri("http://user:psw@host:9090/path1/path2/path3/fileA?query#fragment"); - private const string FullBaseUriGetLeftPart_Path = "http://user:psw@host:9090/path1/path2/path3/fileA"; - private const string FullBaseUriGetLeftPart_Authority = "http://user:psw@host:9090"; - private const string FullBaseUriGetLeftPart_Query = "http://user:psw@host:9090/path1/path2/path3/fileA?query"; + private readonly Uri _fullBaseUri = new Uri("http://user:PLACEHOLDER@host:9090/path1/path2/path3/fileA?query#fragment"); + private const string FullBaseUriGetLeftPart_Path = "http://user:PLACEHOLDER@host:9090/path1/path2/path3/fileA"; + private const string FullBaseUriGetLeftPart_Authority = "http://user:PLACEHOLDER@host:9090"; + private const string FullBaseUriGetLeftPart_Query = "http://user:PLACEHOLDER@host:9090/path1/path2/path3/fileA?query"; [Fact] public void Uri_Relative_BaseVsAbsolute_ReturnsFullAbsolute() @@ -535,7 +535,7 @@ public void Uri_Relative_BaseVsSlashTrippleDotSlash_ReturnsSlashTrippleDotSlash( [Fact] public void Uri_Relative_BaseMadeRelativeToSamePath_ReturnsQueryAndFragment() { - Uri compareUri = new Uri("http://user:psw@host:9090/path1/path2/path3/fileA?AQuery#AFragment"); + Uri compareUri = new Uri("http://user:PLACEHOLDER@host:9090/path1/path2/path3/fileA?AQuery#AFragment"); Uri relative = _fullBaseUri.MakeRelativeUri(compareUri); String expectedResult = "?AQuery#AFragment"; // compareUri.GetParts(UriComponents.Query | UriComponents.Fragment,UriFormat.Unescaped); @@ -545,7 +545,7 @@ public void Uri_Relative_BaseMadeRelativeToSamePath_ReturnsQueryAndFragment() [Fact] public void Uri_Relative_BaseMadeRelativeToLastSlash_ReturnsDotSlashPlusQueryAndFragment() { - Uri compareUri = new Uri("http://user:psw@host:9090/path1/path2/path3/?AQuery#AFragment"); + Uri compareUri = new Uri("http://user:PLACEHOLDER@host:9090/path1/path2/path3/?AQuery#AFragment"); Uri relative = _fullBaseUri.MakeRelativeUri(compareUri); Uri reassembled = new Uri(_fullBaseUri, relative); // Symetric @@ -558,7 +558,7 @@ public void Uri_Relative_BaseMadeRelativeToLastSlash_ReturnsDotSlashPlusQueryAnd [Fact] public void Uri_Relative_BaseMadeRelativeToLastSlash_ReturnsDotSlash() { - Uri compareUri = new Uri("http://user:psw@host:9090/path1/path2/path3/"); + Uri compareUri = new Uri("http://user:PLACEHOLDER@host:9090/path1/path2/path3/"); Uri relative = _fullBaseUri.MakeRelativeUri(compareUri); Uri reassembled = new Uri(_fullBaseUri, relative); // Symetric @@ -570,7 +570,7 @@ public void Uri_Relative_BaseMadeRelativeToLastSlash_ReturnsDotSlash() [Fact] public void Uri_Relative_BaseMadeRelativeToLastSlashWithExtra_ReturnsDotSlashPlusQueryAndFragment() { - Uri compareUri = new Uri("http://user:psw@host:9090/path1/path2/path3/Path4/fileb?AQuery#AFragment"); + Uri compareUri = new Uri("http://user:PLACEHOLDER@host:9090/path1/path2/path3/Path4/fileb?AQuery#AFragment"); Uri relative = _fullBaseUri.MakeRelativeUri(compareUri); Uri reassembled = new Uri(_fullBaseUri, relative); // Symetric @@ -582,7 +582,7 @@ public void Uri_Relative_BaseMadeRelativeToLastSlashWithExtra_ReturnsDotSlashPlu [Fact] public void Uri_Relative_BaseMadeRelativeToSecondToLastSlash_ReturnsDoubleDotSlashPlusQueryAndFragment() { - Uri compareUri = new Uri("http://user:psw@host:9090/path1/path2/?AQuery#AFragment"); + Uri compareUri = new Uri("http://user:PLACEHOLDER@host:9090/path1/path2/?AQuery#AFragment"); Uri relative = _fullBaseUri.MakeRelativeUri(compareUri); Uri reassembled = new Uri(_fullBaseUri, relative); // Symetric @@ -594,7 +594,7 @@ public void Uri_Relative_BaseMadeRelativeToSecondToLastSlash_ReturnsDoubleDotSla [Fact] public void Uri_Relative_BaseMadeRelativeToThirdToLastSlash_ReturnsDoubleDoubleDotSlashPlusQueryAndFragment() { - Uri compareUri = new Uri("http://user:psw@host:9090/path1/?AQuery#AFragment"); + Uri compareUri = new Uri("http://user:PLACEHOLDER@host:9090/path1/?AQuery#AFragment"); Uri relative = _fullBaseUri.MakeRelativeUri(compareUri); Uri reassembled = new Uri(_fullBaseUri, relative); // Symetric @@ -606,7 +606,7 @@ public void Uri_Relative_BaseMadeRelativeToThirdToLastSlash_ReturnsDoubleDoubleD [Fact] public void Uri_Relative_BaseMadeRelativeToEmptyPath_ReturnsTrippleDoubleDotSlashPlusQueryAndFragment() { - Uri compareUri = new Uri("http://user:psw@host:9090/?AQuery#AFragment"); + Uri compareUri = new Uri("http://user:PLACEHOLDER@host:9090/?AQuery#AFragment"); Uri relative = _fullBaseUri.MakeRelativeUri(compareUri); Uri reassembled = new Uri(_fullBaseUri, relative); // Symetric diff --git a/src/System.Runtime/tests/System/Uri.CreateStringTests.cs b/src/System.Runtime/tests/System/Uri.CreateStringTests.cs index bdc34d1e9e1d..aba3ce9db6b3 100644 --- a/src/System.Runtime/tests/System/Uri.CreateStringTests.cs +++ b/src/System.Runtime/tests/System/Uri.CreateStringTests.cs @@ -424,7 +424,7 @@ public static IEnumerable Scheme_Authority_TestData() yield return new object[] { "http://abc\u1234\u2345\u3456@host/", "http", "abc%E1%88%B4%E2%8D%85%E3%91%96", "host", UriHostNameType.Dns, 80, true, false }; yield return new object[] { "http://\u1234abc\u2345\u3456@host/", "http", "%E1%88%B4abc%E2%8D%85%E3%91%96", "host", UriHostNameType.Dns, 80, true, false }; yield return new object[] { "http://\u1234\u2345\u3456abc@host/", "http", "%E1%88%B4%E2%8D%85%E3%91%96abc", "host", UriHostNameType.Dns, 80, true, false }; - yield return new object[] { "http://userinfo!~+-_*()[]:;&$=123USERINFO@host/", "http", "userinfo!~+-_*()[]:;&$=123USERINFO", "host", UriHostNameType.Dns, 80, true, false }; + yield return new object[] { "http://userinfo!~+-_*()[]:;&$=123PLACEHOLDER@host/", "http", "userinfo!~+-_*()[]:;&$=123PLACEHOLDER", "host", UriHostNameType.Dns, 80, true, false }; yield return new object[] { "http://%68%65%6C%6C%6F@host/", "http", "hello", "host", UriHostNameType.Dns, 80, true, false }; yield return new object[] { @"http://£@host/", "http", "%C2%A3", "host", UriHostNameType.Dns, 80, true, false }; yield return new object[] { "http://\u1234@host/", "http", "%E1%88%B4", "host", UriHostNameType.Dns, 80, true, false }; diff --git a/src/System.Security.Cryptography.Algorithms/tests/Rfc2898Tests.cs b/src/System.Security.Cryptography.Algorithms/tests/Rfc2898Tests.cs index 1b240bf994f0..e3d85bed01a4 100644 --- a/src/System.Security.Cryptography.Algorithms/tests/Rfc2898Tests.cs +++ b/src/System.Security.Cryptography.Algorithms/tests/Rfc2898Tests.cs @@ -458,44 +458,44 @@ private static IEnumerable GetKnownValuesTestCases() { CaseName = "SHA256 alternate", HashAlgorithmName = "SHA256", - Password = "abcdefghij", + Password = "PLACEHOLDER", Salt = ascii.GetBytes("abcdefghij"), IterationCount = 1, AnswerHex = ( // T-Block 1 - "9545B9CCBF915299F09BC4E8922B34B042F32689C072539FAEA739FCA4E782" + + "9352784113E5E6DC21FC82ADA3A321D64962F760DF6EAA8E46CEEF4FAF6C6E" + // T-Block 2 - "27B792394D6C13DB121CD16683CD738CB1717C69B34EF2B29E32306D24FCDF"), + "EE6DB97E5852FC4C15FA7C52FACDEDE89B916BCC864028084A2CF0889F7F76"), }; yield return new KnownValuesTestCase { CaseName = "SHA384 alternate", HashAlgorithmName = "SHA384", - Password = "abcdefghij", + Password = "PLACEHOLDER", Salt = ascii.GetBytes("abcdefghij"), IterationCount = 1, AnswerHex = ( // T-Block 1 - "BB8CCC844224775A66E038E59B74B232232AE27C4BF9625BBF3E50317EDD9217BE7B7E07AA5697AF7D2617" + + "B9A10C6C82F36482D76C0C38C982C05F8BB21211ACBE1D1104B4F647DDEAEE179B92ACB0E00A304B791FD0" + // T-Block 2 - "AC02F63AA2B0EC9697B1801E70BD10A6B58CE5DE83DD18F4FFD2E8D9289716510AA0A170EF1D145F4B3247"), + "3C6A08364D0A47CD1F15E0E314800FF3AC9CF2E93B3F81A5EB67FE9F2FE6E86B0430B59902CCB5FD190E67"), }; yield return new KnownValuesTestCase { CaseName = "SHA512 alternate", HashAlgorithmName = "SHA512", - Password = "abcdefghij", + Password = "PLACEHOLDER", Salt = ascii.GetBytes("abcdefghij"), IterationCount = 1, AnswerHex = ( // T-Block 1 - "9D6E96B14A53207C759DBB456B2F038170AF03389096E6EEB2161B3868D3E5" + - "1265A25EF7D7433BF8718DB14F934B6054ACCEA283528AD11A669C7C85196F" + + "AD8CE08CFA8F932CF9FEDDCDB6E4BC6417D61F0465D408C0BFE9656E2C1C47" + + "1424537ADB2D9EBE4E4232F474EFEE2AF347F21A804F64CBC05474A6DCE0A5" + // T-Block 2 - "B5DFAA2185446D6218EBC2D4030A83A4353B302E698C8521B6B69F7D5612EF" + - "AF060798DF40183FE6B71F2D35C60FBE27DFE963EFEE52A5756323BA1A41F6"), + "078100F813C1F8388EC233C1397D5E18C6509B5483141EF836C15A34D6DC67" + + "A3C46A45798A2839CFD239749219E9F2EDAD3249EC8221AFB17C0028A4A0A5"), }; } diff --git a/src/System.Security.Cryptography.X509Certificates/tests/ExportTests.cs b/src/System.Security.Cryptography.X509Certificates/tests/ExportTests.cs index 24dfa156c5eb..49da45a565ef 100644 --- a/src/System.Security.Cryptography.X509Certificates/tests/ExportTests.cs +++ b/src/System.Security.Cryptography.X509Certificates/tests/ExportTests.cs @@ -68,7 +68,7 @@ public static void ExportAsPfx() [ActiveIssue(16705, TestPlatforms.OSX)] public static void ExportAsPfxWithPassword() { - const string password = "Cotton"; + const string password = "PLACEHOLDER"; using (X509Certificate2 c1 = new X509Certificate2(TestData.MsCertificate)) { @@ -87,7 +87,7 @@ public static void ExportAsPfxWithPassword() [ActiveIssue(16705, TestPlatforms.OSX)] public static void ExportAsPfxVerifyPassword() { - const string password = "Cotton"; + const string password = "PLACEHOLDER"; using (X509Certificate2 c1 = new X509Certificate2(TestData.MsCertificate)) { @@ -103,7 +103,7 @@ public static void ExportAsPfxWithPrivateKeyVerifyPassword() { Assert.True(cert.HasPrivateKey, "cert.HasPrivateKey"); - const string password = "Cotton"; + const string password = "PLACEHOLDER"; byte[] pfx = cert.Export(X509ContentType.Pkcs12, password); diff --git a/src/System.Security.Cryptography.Xml/tests/EncryptedXmlTest.cs b/src/System.Security.Cryptography.Xml/tests/EncryptedXmlTest.cs index b004fcd5e6d6..e38c8d132f20 100644 --- a/src/System.Security.Cryptography.Xml/tests/EncryptedXmlTest.cs +++ b/src/System.Security.Cryptography.Xml/tests/EncryptedXmlTest.cs @@ -143,9 +143,10 @@ public void Sample2() { using (Aes aes = Aes.Create()) { + byte[] keydata = Convert.FromBase64String("o/ilseZu+keLBBWGGPlUHweqxIPc4gzZEFWr2nBt640="); aes.Mode = CipherMode.CBC; aes.KeySize = 256; - aes.Key = Convert.FromBase64String("o/ilseZu+keLBBWGGPlUHweqxIPc4gzZEFWr2nBt640="); + aes.Key = keydata; aes.Padding = PaddingMode.Zeros; XmlDocument doc = new XmlDocument(); @@ -174,10 +175,11 @@ public void RoundtripSample1() using (Aes aes = Aes.Create()) { + byte[] keydata = Convert.FromBase64String("o/ilseZu+keLBBWGGPlUHweqxIPc4gzZEFWr2nBt640="); aes.Mode = CipherMode.CBC; aes.KeySize = 256; aes.IV = Convert.FromBase64String("pBUM5P03rZ6AE4ZK5EyBrw=="); - aes.Key = Convert.FromBase64String("o/ilseZu+keLBBWGGPlUHweqxIPc4gzZEFWr2nBt640="); + aes.Key = keydata; aes.Padding = PaddingMode.Zeros; EncryptedXml exml = new EncryptedXml(); diff --git a/src/System.Security.Cryptography.Xml/tests/SignedXmlTest.cs b/src/System.Security.Cryptography.Xml/tests/SignedXmlTest.cs index d18ed6baf64f..e06545dfd891 100644 --- a/src/System.Security.Cryptography.Xml/tests/SignedXmlTest.cs +++ b/src/System.Security.Cryptography.Xml/tests/SignedXmlTest.cs @@ -662,7 +662,7 @@ public void DigestValue_CRLF() Assert.Equal("IKbfdK2/DMfXyezCf5QggVCXfk8=", Convert.ToBase64String(digest)); - X509Certificate2 cert = new X509Certificate2(_pkcs12, "mono"); + X509Certificate2 cert = new X509Certificate2(_pkcs12, "PLACEHOLDER"); SignedXml signedXml = new SignedXml(doc); signedXml.SigningKey = cert.PrivateKey; signedXml.SignedInfo.CanonicalizationMethod = SignedXml.XmlDsigExcC14NTransformUrl; @@ -721,7 +721,7 @@ public void DigestValue_LF() Assert.Equal("e3dsi1xK8FAx1vsug7J203JbEAU=", Convert.ToBase64String(digest)); - X509Certificate2 cert = new X509Certificate2(_pkcs12, "mono"); + X509Certificate2 cert = new X509Certificate2(_pkcs12, "PLACEHOLDER"); SignedXml signedXml = new SignedXml(doc); signedXml.SigningKey = cert.PrivateKey; signedXml.SignedInfo.SignatureMethod = SignedXml.XmlDsigRSASHA1Url; @@ -763,7 +763,7 @@ public void DigestValue_LF() [Fact] public void SignedXML_CRLF_Invalid() { - X509Certificate2 cert = new X509Certificate2(_pkcs12, "mono"); + X509Certificate2 cert = new X509Certificate2(_pkcs12, "PLACEHOLDER"); XmlDocument doc = new XmlDocument(); doc.LoadXml(string.Format(CultureInfo.InvariantCulture, @@ -826,7 +826,7 @@ public void SignedXML_CRLF_Invalid() [Fact] public void SignedXML_CRLF_Valid() { - X509Certificate2 cert = new X509Certificate2(_pkcs12, "mono"); + X509Certificate2 cert = new X509Certificate2(_pkcs12, "PLACEHOLDER"); XmlDocument doc = CreateSignedXml(cert, SignedXml.XmlDsigExcC14NTransformUrl, "\r\n"); Assert.Equal(string.Format(CultureInfo.InvariantCulture, "{0}" + @@ -883,7 +883,7 @@ public void SignedXML_CRLF_Valid() [Fact] public void SignedXML_LF_Valid() { - X509Certificate2 cert = new X509Certificate2(_pkcs12, "mono"); + X509Certificate2 cert = new X509Certificate2(_pkcs12, "PLACEHOLDER"); XmlDocument doc = CreateSignedXml(cert, SignedXml.XmlDsigExcC14NTransformUrl, "\n"); Assert.Equal(string.Format(CultureInfo.InvariantCulture, "{0}" + @@ -941,7 +941,7 @@ public void SignedXML_LF_Valid() public void MultipleX509Certificates() { XmlDocument doc = null; - X509Certificate2 cert = new X509Certificate2(_pkcs12, "mono"); + X509Certificate2 cert = new X509Certificate2(_pkcs12, "PLACEHOLDER"); doc = CreateSignedXml(cert, SignedXml.XmlDsigExcC14NTransformUrl, "\n"); Assert.True(VerifySignedXml(doc), "#1"); @@ -1068,137 +1068,25 @@ string Stream2String(Stream s) 0x4c, 0xb9, 0x7d, 0x87, 0xc6, 0x2b, 0xf0, 0x41, 0xee, 0x6c, 0xba, 0x08, 0xcf, 0x69, 0x31, 0x18 }; - private static byte[] _pkcs12 = new byte[] { - 0x30, 0x82, 0x05, 0x8d, 0x02, 0x01, 0x03, 0x30, 0x82, 0x05, 0x47, - 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x07, 0x01, - 0xa0, 0x82, 0x05, 0x38, 0x04, 0x82, 0x05, 0x34, 0x30, 0x82, 0x05, - 0x30, 0x30, 0x82, 0x02, 0x3f, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, - 0xf7, 0x0d, 0x01, 0x07, 0x06, 0xa0, 0x82, 0x02, 0x30, 0x30, 0x82, - 0x02, 0x2c, 0x02, 0x01, 0x00, 0x30, 0x82, 0x02, 0x25, 0x06, 0x09, - 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x07, 0x01, 0x30, 0x1c, - 0x06, 0x0a, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x0c, 0x01, - 0x03, 0x30, 0x0e, 0x04, 0x08, 0x6e, 0x0a, 0x50, 0x20, 0xc3, 0x11, - 0x49, 0x07, 0x02, 0x02, 0x07, 0xd0, 0x80, 0x82, 0x01, 0xf8, 0x74, - 0x40, 0x07, 0x44, 0x6b, 0x80, 0x46, 0xe1, 0x4e, 0x65, 0x5e, 0xf2, - 0xf6, 0x38, 0x90, 0xd1, 0x75, 0x24, 0xd9, 0x72, 0x92, 0x5b, 0x4a, - 0xb9, 0x9e, 0xbd, 0xab, 0xe2, 0xb8, 0x91, 0xc9, 0x48, 0x14, 0x88, - 0x61, 0x7d, 0x06, 0xf9, 0x24, 0x80, 0xb5, 0x36, 0xaf, 0xfe, 0xc0, - 0x59, 0x00, 0x39, 0x3f, 0x78, 0xc0, 0x57, 0xea, 0x1e, 0xcb, 0x29, - 0xa4, 0x5f, 0xba, 0x4b, 0xd9, 0xca, 0x95, 0xab, 0x55, 0x4a, 0x11, - 0x1a, 0xf8, 0xe9, 0xd4, 0xc0, 0x08, 0x55, 0xfb, 0x69, 0x09, 0x0d, - 0x5b, 0xed, 0x02, 0xcc, 0x55, 0xfe, 0x05, 0x2e, 0x45, 0xa7, 0x8d, - 0x63, 0x9a, 0xda, 0x6c, 0xc7, 0xe1, 0xcb, 0x5c, 0xa7, 0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, 0x9f, 0x76, 0xfc, 0xe8, 0x00, 0xfc, 0xf7, 0xba, - 0xd2, 0x45, 0x92, 0x14, 0xb5, 0xe2, 0x93, 0x41, 0x09, 0xea, 0x5b, - 0x5e, 0xda, 0x66, 0x92, 0xd1, 0x93, 0x7a, 0xc0, 0xe1, 0x2f, 0xed, - 0x29, 0x78, 0x80, 0xff, 0x79, 0x0e, 0xda, 0x78, 0x7e, 0x71, 0xa4, - 0x31, 0x2f, 0xe9, 0x48, 0xab, 0xc9, 0x40, 0x7d, 0x63, 0x06, 0xd6, - 0xb5, 0x2b, 0x49, 0xba, 0x43, 0x56, 0x69, 0xc5, 0xc2, 0x85, 0x37, - 0xdb, 0xe7, 0x39, 0x87, 0x8d, 0x14, 0x15, 0x55, 0x76, 0x3f, 0x70, - 0xf6, 0xd7, 0x80, 0x82, 0x48, 0x02, 0x64, 0xe1, 0x73, 0x1a, 0xd9, - 0x35, 0x1a, 0x43, 0xf3, 0xde, 0xd4, 0x00, 0x9d, 0x49, 0x2b, 0xc6, - 0x66, 0x19, 0x3e, 0xb8, 0xcc, 0x43, 0xcc, 0xa8, 0x12, 0xa4, 0xad, - 0xcd, 0xe2, 0xe6, 0xb3, 0xdd, 0x7e, 0x80, 0x50, 0xc0, 0xb4, 0x0c, - 0x4c, 0xd2, 0x31, 0xf3, 0xf8, 0x49, 0x31, 0xbe, 0xf2, 0x7d, 0x60, - 0x38, 0xe0, 0x60, 0xdf, 0x7b, 0x58, 0xe0, 0xf9, 0x6e, 0x68, 0x79, - 0x33, 0xb2, 0x2a, 0x53, 0x4c, 0x5a, 0x9d, 0xb3, 0x81, 0x4b, 0x19, - 0x21, 0xe2, 0x3a, 0x42, 0x07, 0x25, 0x5a, 0xee, 0x1f, 0x5d, 0xa2, - 0xca, 0xf7, 0x2f, 0x3c, 0x9b, 0xb0, 0xbc, 0xe7, 0xaf, 0x8c, 0x2f, - 0x52, 0x43, 0x79, 0x94, 0xb0, 0xee, 0xc4, 0x53, 0x09, 0xc0, 0xc9, - 0x21, 0x39, 0x64, 0x82, 0xc3, 0x54, 0xb8, 0x65, 0xf8, 0xdc, 0xb3, - 0xdf, 0x4d, 0xc4, 0x63, 0x59, 0x14, 0x37, 0xd6, 0xba, 0xa3, 0x98, - 0xda, 0x99, 0x02, 0xdd, 0x7a, 0x87, 0x3e, 0x34, 0xb5, 0x4b, 0x0a, - 0xb4, 0x2d, 0xea, 0x19, 0x24, 0xd1, 0xc2, 0x9f, 0x30, 0x82, 0x02, - 0xe9, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x07, - 0x01, 0xa0, 0x82, 0x02, 0xda, 0x04, 0x82, 0x02, 0xd6, 0x30, 0x82, - 0x02, 0xd2, 0x30, 0x82, 0x02, 0xce, 0x06, 0x0b, 0x2a, 0x86, 0x48, - 0x86, 0xf7, 0x0d, 0x01, 0x0c, 0x0a, 0x01, 0x02, 0xa0, 0x82, 0x02, - 0xa6, 0x30, 0x82, 0x02, 0xa2, 0x30, 0x1c, 0x06, 0x0a, 0x2a, 0x86, - 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x0c, 0x01, 0x03, 0x30, 0x0e, 0x04, - 0x08, 0xe0, 0x21, 0x4f, 0x90, 0x7d, 0x86, 0x72, 0xc7, 0x02, 0x02, - 0x07, 0xd0, 0x04, 0x82, 0x02, 0x80, 0x92, 0xac, 0xe8, 0x52, 0xa6, - 0x3e, 0xed, 0x3d, 0xbc, 0x28, 0x5f, 0xb9, 0x45, 0x76, 0x27, 0x95, - 0xf8, 0x6a, 0xc5, 0x17, 0x97, 0x46, 0x58, 0xe9, 0x15, 0x7c, 0x68, - 0x62, 0x67, 0xb5, 0x2f, 0x1b, 0x64, 0x27, 0x9d, 0xfd, 0x67, 0x66, - 0x42, 0x21, 0x5c, 0xf4, 0x64, 0x37, 0xcc, 0xc0, 0x04, 0x01, 0x91, - 0x6c, 0x6b, 0x84, 0x96, 0xae, 0x04, 0xfe, 0xcc, 0x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0xc8, 0x68, 0x11, 0xfb, 0x5f, 0x6b, 0xc8, 0x09, - 0x74, 0xcb, 0x76, 0x08, 0xbc, 0x28, 0x63, 0x57, 0x04, 0xb0, 0x80, - 0xd1, 0x53, 0x60, 0x50, 0x44, 0xba, 0x80, 0x48, 0x5e, 0x0e, 0x9a, - 0xe5, 0x64, 0x26, 0x7a, 0x88, 0xb9, 0xc6, 0x33, 0x31, 0x15, 0x30, - 0x13, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x09, - 0x15, 0x31, 0x06, 0x04, 0x04, 0x01, 0x00, 0x00, 0x00, 0x30, 0x3d, - 0x30, 0x21, 0x30, 0x09, 0x06, 0x05, 0x2b, 0x0e, 0x03, 0x02, 0x1a, - 0x05, 0x00, 0x04, 0x14, 0x32, 0x55, 0x07, 0xa2, 0x67, 0xf3, 0x76, - 0x4d, 0x0b, 0x6f, 0xa4, 0xa0, 0x7b, 0xce, 0x2f, 0xc5, 0xff, 0xbe, - 0x3e, 0x38, 0x04, 0x14, 0x52, 0xf8, 0xb3, 0xeb, 0xc3, 0xda, 0x79, - 0xfa, 0x75, 0x89, 0x67, 0x33, 0x01, 0xd0, 0xb0, 0x13, 0xfa, 0x11, - 0x94, 0xac, 0x02, 0x02, 0x07, 0xd0 }; + private static byte[] _pkcs12 = Convert.FromBase64String(@" +MIIFoQIBAzCCBWcGCSqGSIb3DQEHAaCCBVgEggVUMIIFUDCCAk8GCSqGSIb3DQEHBqCCAkAwggI8AgEAMIICNQYJKoZIhvcNAQcBMBwGCiqGSIb3 +DQEMAQYwDgQI5L3Ub8odcrcCAggAgIICCD+js0jgpI2kndrNEpsVW2hjtms//GtjAd0cdMemEHjGwCWycMGFjA9pwJQ6KCadmq9z5gaiOmp7RHCh +rXDTZEQ9ox0FEuHb2e37jheuWN84Av0Z+DX/leSv1g+du5YXW1tEoAXOy1qRle+ccSVsWe9MXf/aEfSGmMnV5mj+v2twjSFcD3bFAx5XmeP6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Pd4WaGWO3imbTH9ZHzBXgLApIAj5Y4wIU8WMKTmHGDtYR9osfBN +Bpv5l51vl4+9khiuIHNVjiSs4jGXY2MtyoLHnOvyzYtYGtokjy4neduPDNcHXgIx4w5iR2sKEp2PEyJw2/6S3+3Cn5jNbP6sfpL5nrNKBPsG64EO +yszdKtA3OfOZpDG7yPHN6nwsoRFJtNmivvu+ZMjglP22Bpa7DNRqwQvPnGGQRVis8DiYjCgJFhzpPup0tlxGkP2lsixaqwR90CPX+tfuDGVAISVW +ihC2/gKdZEMZmU+93ef/qakzP4ITwQ/1KNt2ue9twV8CD4SFSryHwQoKVy2Oz3wiABcYlxpxjTir5OlBz84AoGNHa8HnYXwLHd6kSnBx+R8UOi9u +bvWmYaCaPfgfxpcxJTAjBgkqhkiG9w0BCRUxFgQUC9DfoAITl/oaT3u9jmeopQju2ikwMTAhMAkGBSsOAwIaBQAEFOh2zDdsYqMQ8vNLzWnDogeJ +4KthBAjYc6FBEeyGYgICCAA="); public SignedXml SignHMAC(string uri, KeyedHashAlgorithm mac, bool expectedToVerify) { diff --git a/src/System.Security.Cryptography.Xml/tests/TestHelpers.cs b/src/System.Security.Cryptography.Xml/tests/TestHelpers.cs index 6dfdb6aff5e1..ed57bc330edf 100644 --- a/src/System.Security.Cryptography.Xml/tests/TestHelpers.cs +++ b/src/System.Security.Cryptography.Xml/tests/TestHelpers.cs @@ -186,11 +186,11 @@ public static IEnumerable GetSymmetricAlgorithms(bool } private static readonly byte[] SamplePfx = Convert.FromBase64String( - @"MIIFpQIBAzCCBV8GCSqGSIb3DQEHAaCCBVAEggVMMIIFSDCCAl8GCSqGSIb3DQEHBqCCAlAwggJMAgEAMIICRQYJKoZIhvcNAQcBMBwGCiqGSIb3DQEMAQMwDgQIGTfVa4+vR1UCAgfQgIICGJuFE9alFWJFkaoeewKDIEnVwRxXfMsi8dcySYnp7jljEUQBfW/GIbOf7Lg2nHd0qxvxYI2YL4Zs+d0jWbqfNHamGFCMPe1dK957Z2PsKXR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stAsiwY0xMY8JlP1MDylUUR9S1cqplYwl66ECckEijcpxxlvdxouRMKQ3yMejbpEtIddiLgaV3htUqVzeDQMN2pPBYCYd9qls2GzjiuUUNyz6N1knWfwak+V6gmrD884f/DsQYojUZaev3yfW+VlhWPaRupw8u70ARx6sH+S1e010BCiidZbcgj4GopI6vn1F5LzCiWF9CgNKyJmLAFhR9mmTN213Fj902C3TCKXQirXHMqvKK/btDUQNVaqM/5wrCR5M6LeAcyn0v/O1eYiVrSMe3UiqQO7U7Q8B1P2usS7Z2nuq6/PTHIUxJTAjBgkqhkiG9w0BCRUxFgQU7pIhWsIBVCkxlqGvRxgIM0O2LcUwMTAhMAkGBSsOAwIaBQAEFD14Ryp7yXCPNFqqsG1CTrb5l12uBAhGCzGln9YWkgICCAA="); public static X509Certificate2 GetSampleX509Certificate() { - return new X509Certificate2(SamplePfx, "mono"); + return new X509Certificate2(SamplePfx, "PLACEHOLDER"); } public static Stream LoadResourceStream(string resourceName) From a05ebde78dc15f18afe5a6ba4e64a452c3574216 Mon Sep 17 00:00:00 2001 From: Jan Jahoda Date: Thu, 18 Mar 2021 12:03:57 +0100 Subject: [PATCH 2/5] Remove crypto changes --- .../tests/SignedXmlTest.cs | 162 +++++++++++++++--- .../tests/TestHelpers.cs | 4 +- 2 files changed, 139 insertions(+), 27 deletions(-) diff --git a/src/System.Security.Cryptography.Xml/tests/SignedXmlTest.cs b/src/System.Security.Cryptography.Xml/tests/SignedXmlTest.cs index e06545dfd891..d18ed6baf64f 100644 --- a/src/System.Security.Cryptography.Xml/tests/SignedXmlTest.cs +++ b/src/System.Security.Cryptography.Xml/tests/SignedXmlTest.cs @@ -662,7 +662,7 @@ public void DigestValue_CRLF() Assert.Equal("IKbfdK2/DMfXyezCf5QggVCXfk8=", Convert.ToBase64String(digest)); - X509Certificate2 cert = new X509Certificate2(_pkcs12, "PLACEHOLDER"); + X509Certificate2 cert = new X509Certificate2(_pkcs12, "mono"); SignedXml signedXml = new SignedXml(doc); signedXml.SigningKey = cert.PrivateKey; signedXml.SignedInfo.CanonicalizationMethod = SignedXml.XmlDsigExcC14NTransformUrl; @@ -721,7 +721,7 @@ public void DigestValue_LF() Assert.Equal("e3dsi1xK8FAx1vsug7J203JbEAU=", Convert.ToBase64String(digest)); - X509Certificate2 cert = new X509Certificate2(_pkcs12, "PLACEHOLDER"); + X509Certificate2 cert = new X509Certificate2(_pkcs12, "mono"); SignedXml signedXml = new SignedXml(doc); signedXml.SigningKey = cert.PrivateKey; signedXml.SignedInfo.SignatureMethod = SignedXml.XmlDsigRSASHA1Url; @@ -763,7 +763,7 @@ public void DigestValue_LF() [Fact] public void SignedXML_CRLF_Invalid() { - X509Certificate2 cert = new X509Certificate2(_pkcs12, "PLACEHOLDER"); + X509Certificate2 cert = new X509Certificate2(_pkcs12, "mono"); XmlDocument doc = new XmlDocument(); doc.LoadXml(string.Format(CultureInfo.InvariantCulture, @@ -826,7 +826,7 @@ public void SignedXML_CRLF_Invalid() [Fact] public void SignedXML_CRLF_Valid() { - X509Certificate2 cert = new X509Certificate2(_pkcs12, "PLACEHOLDER"); + X509Certificate2 cert = new X509Certificate2(_pkcs12, "mono"); XmlDocument doc = CreateSignedXml(cert, SignedXml.XmlDsigExcC14NTransformUrl, "\r\n"); Assert.Equal(string.Format(CultureInfo.InvariantCulture, "{0}" + @@ -883,7 +883,7 @@ public void SignedXML_CRLF_Valid() [Fact] public void SignedXML_LF_Valid() { - X509Certificate2 cert = new X509Certificate2(_pkcs12, "PLACEHOLDER"); + X509Certificate2 cert = new X509Certificate2(_pkcs12, "mono"); XmlDocument doc = CreateSignedXml(cert, SignedXml.XmlDsigExcC14NTransformUrl, "\n"); Assert.Equal(string.Format(CultureInfo.InvariantCulture, "{0}" + @@ -941,7 +941,7 @@ public void SignedXML_LF_Valid() public void MultipleX509Certificates() { XmlDocument doc = null; - X509Certificate2 cert = new X509Certificate2(_pkcs12, "PLACEHOLDER"); + X509Certificate2 cert = new X509Certificate2(_pkcs12, "mono"); doc = CreateSignedXml(cert, SignedXml.XmlDsigExcC14NTransformUrl, "\n"); Assert.True(VerifySignedXml(doc), "#1"); @@ -1068,25 +1068,137 @@ string Stream2String(Stream s) 0x4c, 0xb9, 0x7d, 0x87, 0xc6, 0x2b, 0xf0, 0x41, 0xee, 0x6c, 0xba, 0x08, 0xcf, 0x69, 0x31, 0x18 }; - private static byte[] _pkcs12 = Convert.FromBase64String(@" -MIIFoQIBAzCCBWcGCSqGSIb3DQEHAaCCBVgEggVUMIIFUDCCAk8GCSqGSIb3DQEHBqCCAkAwggI8AgEAMIICNQYJKoZIhvcNAQcBMBwGCiqGSIb3 -DQEMAQYwDgQI5L3Ub8odcrcCAggAgIICCD+js0jgpI2kndrNEpsVW2hjtms//GtjAd0cdMemEHjGwCWycMGFjA9pwJQ6KCadmq9z5gaiOmp7RHCh -rXDTZEQ9ox0FEuHb2e37jheuWN84Av0Z+DX/leSv1g+du5YXW1tEoAXOy1qRle+ccSVsWe9MXf/aEfSGmMnV5mj+v2twjSFcD3bFAx5XmeP6sGjR -doGDdIWGkTr94XczdoK1rJPF5BrVzdjcNh5+8yLh0aWixAxjkSQlc95d2TK464YzwQcJKm21H+43Wn4GI4cV4ifZ607/64uPnTPDFT2KI7+rTsJd -+Qo+rz65wVe7T6zsqUyC5o0S41ezBlWHW+EBP+Jupji3JF4aAzOAwkeX/zF9oNveXGTyKc7M73p9M9SIrS9AnFS78NBlBF5DFj1QvGpeawB/RBIY -nGVbdfHPxgLyZC+RoMQzNA71x0IpujNg9dQ2oJCLc55vl4BYGcPeuaAHMPg4+g4BUlrwtfY4SjlS3YQRse7rYtVkkDRG4Mg77nj9dbTo3QPP+IlB -QD7lpLf+r+PJXtObyim8cGQOEKiYZdwmodNFWhx782jXxmhIOIyJY+2zAxh6nNZj7aBNqNY0wMJwD64GZij69BkH5oron9qm/oWQLDJcVT3/6gXb -a8BvMDGJbtRrvcP9uQPnanubajjhFhAdvAcRGQz5lB8vu2ZqVECyOxkwggL5Bgkqhki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Yc6FBEeyGYgICCAA="); + private static byte[] _pkcs12 = new byte[] { + 0x30, 0x82, 0x05, 0x8d, 0x02, 0x01, 0x03, 0x30, 0x82, 0x05, 0x47, + 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x07, 0x01, + 0xa0, 0x82, 0x05, 0x38, 0x04, 0x82, 0x05, 0x34, 0x30, 0x82, 0x05, + 0x30, 0x30, 0x82, 0x02, 0x3f, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, + 0xf7, 0x0d, 0x01, 0x07, 0x06, 0xa0, 0x82, 0x02, 0x30, 0x30, 0x82, + 0x02, 0x2c, 0x02, 0x01, 0x00, 0x30, 0x82, 0x02, 0x25, 0x06, 0x09, + 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x07, 0x01, 0x30, 0x1c, + 0x06, 0x0a, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x0c, 0x01, + 0x03, 0x30, 0x0e, 0x04, 0x08, 0x6e, 0x0a, 0x50, 0x20, 0xc3, 0x11, + 0x49, 0x07, 0x02, 0x02, 0x07, 0xd0, 0x80, 0x82, 0x01, 0xf8, 0x74, + 0x40, 0x07, 0x44, 0x6b, 0x80, 0x46, 0xe1, 0x4e, 0x65, 0x5e, 0xf2, + 0xf6, 0x38, 0x90, 0xd1, 0x75, 0x24, 0xd9, 0x72, 0x92, 0x5b, 0x4a, + 0xb9, 0x9e, 0xbd, 0xab, 0xe2, 0xb8, 0x91, 0xc9, 0x48, 0x14, 0x88, + 0x61, 0x7d, 0x06, 0xf9, 0x24, 0x80, 0xb5, 0x36, 0xaf, 0xfe, 0xc0, + 0x59, 0x00, 0x39, 0x3f, 0x78, 0xc0, 0x57, 0xea, 0x1e, 0xcb, 0x29, + 0xa4, 0x5f, 0xba, 0x4b, 0xd9, 0xca, 0x95, 0xab, 0x55, 0x4a, 0x11, + 0x1a, 0xf8, 0xe9, 0xd4, 0xc0, 0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 0x8b, + 0xff, 0xdd, 0xdc, 0x34, 0x46, 0x4f, 0x15, 0xde, 0xdb, 0xc4, 0xeb, + 0x62, 0x3b, 0x7c, 0x25, 0x1a, 0x13, 0x8b, 0xda, 0x3b, 0x59, 0x2a, + 0xb8, 0x50, 0xe3, 0x9f, 0x76, 0xfc, 0xe8, 0x00, 0xfc, 0xf7, 0xba, + 0xd2, 0x45, 0x92, 0x14, 0xb5, 0xe2, 0x93, 0x41, 0x09, 0xea, 0x5b, + 0x5e, 0xda, 0x66, 0x92, 0xd1, 0x93, 0x7a, 0xc0, 0xe1, 0x2f, 0xed, + 0x29, 0x78, 0x80, 0xff, 0x79, 0x0e, 0xda, 0x78, 0x7e, 0x71, 0xa4, + 0x31, 0x2f, 0xe9, 0x48, 0xab, 0xc9, 0x40, 0x7d, 0x63, 0x06, 0xd6, + 0xb5, 0x2b, 0x49, 0xba, 0x43, 0x56, 0x69, 0xc5, 0xc2, 0x85, 0x37, + 0xdb, 0xe7, 0x39, 0x87, 0x8d, 0x14, 0x15, 0x55, 0x76, 0x3f, 0x70, + 0xf6, 0xd7, 0x80, 0x82, 0x48, 0x02, 0x64, 0xe1, 0x73, 0x1a, 0xd9, + 0x35, 0x1a, 0x43, 0xf3, 0xde, 0xd4, 0x00, 0x9d, 0x49, 0x2b, 0xc6, + 0x66, 0x19, 0x3e, 0xb8, 0xcc, 0x43, 0xcc, 0xa8, 0x12, 0xa4, 0xad, + 0xcd, 0xe2, 0xe6, 0xb3, 0xdd, 0x7e, 0x80, 0x50, 0xc0, 0xb4, 0x0c, + 0x4c, 0xd2, 0x31, 0xf3, 0xf8, 0x49, 0x31, 0xbe, 0xf2, 0x7d, 0x60, + 0x38, 0xe0, 0x60, 0xdf, 0x7b, 0x58, 0xe0, 0xf9, 0x6e, 0x68, 0x79, + 0x33, 0xb2, 0x2a, 0x53, 0x4c, 0x5a, 0x9d, 0xb3, 0x81, 0x4b, 0x19, + 0x21, 0xe2, 0x3a, 0x42, 0x07, 0x25, 0x5a, 0xee, 0x1f, 0x5d, 0xa2, + 0xca, 0xf7, 0x2f, 0x3c, 0x9b, 0xb0, 0xbc, 0xe7, 0xaf, 0x8c, 0x2f, + 0x52, 0x43, 0x79, 0x94, 0xb0, 0xee, 0xc4, 0x53, 0x09, 0xc0, 0xc9, + 0x21, 0x39, 0x64, 0x82, 0xc3, 0x54, 0xb8, 0x65, 0xf8, 0xdc, 0xb3, + 0xdf, 0x4d, 0xc4, 0x63, 0x59, 0x14, 0x37, 0xd6, 0xba, 0xa3, 0x98, + 0xda, 0x99, 0x02, 0xdd, 0x7a, 0x87, 0x3e, 0x34, 0xb5, 0x4b, 0x0a, + 0xb4, 0x2d, 0xea, 0x19, 0x24, 0xd1, 0xc2, 0x9f, 0x30, 0x82, 0x02, + 0xe9, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x07, + 0x01, 0xa0, 0x82, 0x02, 0xda, 0x04, 0x82, 0x02, 0xd6, 0x30, 0x82, + 0x02, 0xd2, 0x30, 0x82, 0x02, 0xce, 0x06, 0x0b, 0x2a, 0x86, 0x48, + 0x86, 0xf7, 0x0d, 0x01, 0x0c, 0x0a, 0x01, 0x02, 0xa0, 0x82, 0x02, + 0xa6, 0x30, 0x82, 0x02, 0xa2, 0x30, 0x1c, 0x06, 0x0a, 0x2a, 0x86, + 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x0c, 0x01, 0x03, 0x30, 0x0e, 0x04, + 0x08, 0xe0, 0x21, 0x4f, 0x90, 0x7d, 0x86, 0x72, 0xc7, 0x02, 0x02, + 0x07, 0xd0, 0x04, 0x82, 0x02, 0x80, 0x92, 0xac, 0xe8, 0x52, 0xa6, + 0x3e, 0xed, 0x3d, 0xbc, 0x28, 0x5f, 0xb9, 0x45, 0x76, 0x27, 0x95, + 0xf8, 0x6a, 0xc5, 0x17, 0x97, 0x46, 0x58, 0xe9, 0x15, 0x7c, 0x68, + 0x62, 0x67, 0xb5, 0x2f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aa, 0x78, 0x6c, 0xcf, 0xe9, 0x75, 0x7c, 0x80, + 0x04, 0x05, 0x52, 0xda, 0x13, 0x41, 0xb0, 0x27, 0x0f, 0x82, 0xa3, + 0x81, 0xd8, 0xf7, 0xdc, 0x61, 0xbb, 0x98, 0x32, 0x5a, 0x88, 0xbf, + 0x49, 0xc1, 0x76, 0x83, 0xcd, 0xc4, 0xb4, 0xca, 0x8d, 0x36, 0x88, + 0xee, 0xdb, 0xc5, 0xf4, 0x13, 0x28, 0x4d, 0xae, 0x7a, 0x31, 0x3e, + 0x77, 0x19, 0xab, 0x11, 0x15, 0x29, 0xd4, 0xcf, 0xb4, 0x73, 0x36, + 0x92, 0x1e, 0x4e, 0x5d, 0x35, 0x57, 0x84, 0x45, 0x9d, 0x05, 0x3c, + 0x44, 0x86, 0x08, 0x0b, 0x90, 0x29, 0xf9, 0xe6, 0x48, 0xaf, 0xf4, + 0x62, 0xd2, 0x4d, 0x32, 0x1a, 0xe9, 0xbf, 0x3a, 0x7b, 0x25, 0x4a, + 0x03, 0xfb, 0x40, 0x1d, 0x71, 0x2c, 0x10, 0x54, 0xdc, 0xbf, 0xf4, + 0x50, 0x85, 0x15, 0x11, 0xb1, 0x2d, 0x03, 0x2c, 0xe4, 0x8a, 0xce, + 0xec, 0x6e, 0x46, 0x06, 0x13, 0x3c, 0x97, 0x8d, 0xdd, 0xf6, 0x1e, + 0x62, 0xb4, 0x8d, 0xfa, 0x2c, 0x86, 0x87, 0x64, 0x5e, 0xec, 0xc8, + 0x84, 0xd1, 0x3d, 0xc5, 0x76, 0x4a, 0x31, 0xd3, 0xdb, 0x34, 0x6e, + 0x8a, 0x49, 0xd6, 0x38, 0xbb, 0x05, 0xe9, 0x4d, 0xf1, 0xde, 0x3e, + 0xa4, 0x47, 0xdd, 0xe8, 0xa8, 0xf1, 0xba, 0x55, 0xce, 0xca, 0x5b, + 0x57, 0xd7, 0xc8, 0x9f, 0x09, 0xa3, 0x8e, 0x58, 0x83, 0x21, 0x0a, + 0x6e, 0xd3, 0x70, 0x9c, 0xb9, 0x7c, 0x52, 0x98, 0x53, 0xcb, 0xda, + 0x9d, 0xaf, 0xb7, 0x4b, 0xf7, 0x48, 0x91, 0x7e, 0x78, 0x20, 0x19, + 0xe3, 0x41, 0x9d, 0xc8, 0x68, 0x11, 0xfb, 0x5f, 0x6b, 0xc8, 0x09, + 0x74, 0xcb, 0x76, 0x08, 0xbc, 0x28, 0x63, 0x57, 0x04, 0xb0, 0x80, + 0xd1, 0x53, 0x60, 0x50, 0x44, 0xba, 0x80, 0x48, 0x5e, 0x0e, 0x9a, + 0xe5, 0x64, 0x26, 0x7a, 0x88, 0xb9, 0xc6, 0x33, 0x31, 0x15, 0x30, + 0x13, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x09, + 0x15, 0x31, 0x06, 0x04, 0x04, 0x01, 0x00, 0x00, 0x00, 0x30, 0x3d, + 0x30, 0x21, 0x30, 0x09, 0x06, 0x05, 0x2b, 0x0e, 0x03, 0x02, 0x1a, + 0x05, 0x00, 0x04, 0x14, 0x32, 0x55, 0x07, 0xa2, 0x67, 0xf3, 0x76, + 0x4d, 0x0b, 0x6f, 0xa4, 0xa0, 0x7b, 0xce, 0x2f, 0xc5, 0xff, 0xbe, + 0x3e, 0x38, 0x04, 0x14, 0x52, 0xf8, 0xb3, 0xeb, 0xc3, 0xda, 0x79, + 0xfa, 0x75, 0x89, 0x67, 0x33, 0x01, 0xd0, 0xb0, 0x13, 0xfa, 0x11, + 0x94, 0xac, 0x02, 0x02, 0x07, 0xd0 }; public SignedXml SignHMAC(string uri, KeyedHashAlgorithm mac, bool expectedToVerify) { diff --git a/src/System.Security.Cryptography.Xml/tests/TestHelpers.cs b/src/System.Security.Cryptography.Xml/tests/TestHelpers.cs index ed57bc330edf..6dfdb6aff5e1 100644 --- a/src/System.Security.Cryptography.Xml/tests/TestHelpers.cs +++ b/src/System.Security.Cryptography.Xml/tests/TestHelpers.cs @@ -186,11 +186,11 @@ public static IEnumerable GetSymmetricAlgorithms(bool } private static readonly byte[] SamplePfx = Convert.FromBase64String( - @"MIIFuQIBAzCCBX8GCSqGSIb3DQEHAaCCBXAEggVsMIIFaDCCAm8GCSqGSIb3DQEHBqCCAmAwggJcAgEAMIICVQYJKoZIhvcNAQcBMBwGCiqGSIb3DQEMAQYwDgQIsT5d6IgBq60CAggAgIICKKbgzzQEQCYYvCxqVfuMGiJr1BEb1mvMqDTKEWi2H7/AV/ORaodTqdolJQpVLFvjJKzdO60WazEd9A3/+AkfZS1df01DWvYcA2SriPj7bF5MO6Q7PiV3VLcia+xantZ8aaHnYy9J/GrbVPMt+0IdeKmN+SOEFzD3OvRhwApF85winEM47ciCLYcnYJiP9uROx0SO4fz9B1s7ar9KH8N5wm3R29DINQICdOhZU8DPdxIALsLKxEj7g3Hh4aMkPyZU4/IQ58ItmZS4e5irlIzGYYU7tpxa06FF6m7RPns2ZBw5TpX7lMUiok7rrmUq5V84lLdyrv1E3UwVAnKEeTwIB0XnzpHE3WGjwxiV6WCiVnDu/h4vGRYS8HHKhuC+OF6SU+7P2Q+B/7F2xQFDE9uWxCtkP2fBqhq7aKtsl6zGssVldkSww4Im0htfv7r6lvqe/AwPXDDxYRfmYh93uMRPosBl55HtYkVMz0XWJBc8nc3c6uHr4Z6t6EnNAoj6mgc4k63Me48eudXkxD45YYtfp0ocv/nTL3ZNxCP72sI/04ZYwKuw2ElLhEC8oDf6TC0ftuqFR9zZNQIJ8Sbj9zMG/Fa34l3NXOCi9A9u1KeEpX25Pia82U78JbfJMq0YUfGy8Hcz0cNs4f/JfF2mESQjQqK96L4KcPdOym8KIMoCRAUnMpATJBwZsJAUnq9R0Q0Q0TwPwJ8VGwFH8eb+xxHfttiPqnCg3VVdSjCCAvEGCSqGSIb3DQEHAaCCAuIEggLeMIIC2jCCAtYGCyqGSIb3DQEMCgECoIICnjCCApowHAYKKoZIhvcNAQwBAzAOBAhsdnN4cibOjgICCAAEggJ4Jn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F1EzDVdZGkrrE8mot3Y4z6bvwqip2tUUbHuMnC+/1ikAcJzCOw4NpnEWCRtIJxgJ9es8E8CUfHESnWKe4nh6tJVJ15B8/7oF7N6j7oq4Oj346JthKoWWkzifNaH79A60/uFh08Rv7zrtJf6kedY6Ve2bR5lhWn0cv9Q6IaoqTmKKTmKJnjdQO9lKRCR6iI2OsYtXBropD8xhNNqsyfpNmP0G6wFiEZZxZjWOkZEJLUzFbH+Su+7l2l4FN9sM7k211/l3/3YF1QJHwZsgL98DZL4qE+nkuZQcdtOUx8QTyTOcVb3IzgCAwZm0rgdXQpJ9yRBgOC/6MnqaCPI0jJuavXF/a28GJWWGlazx7SWTrbzNVJ83ZhQ+pfPEPtMi3t0YVLLvapu3otgpiMkv4ew/ssXwYbg6xBWfotK+NG1cPwVFy9/V9+H5dpdvRI/le2QG0F5xCfCeKh/3AuNiMPEGoVUR5kj5cwFK6eskvt/+74ZenxfNPZ2Uttiw8DsqtTx1gxhcSZeU5YWpO7O78RaYE4Ll4kPbbvIaR18Napb6NKP846z02zvaw+feXARLe0HUY58TlmUjSX3MZRK4PEdyMIQ/URyPimj4rImaDfFrKPAHIjqT3EKv+KuNs8TEVMBMGCSqGSIb3DQEJFTEGBAQBAAAAMD0wITAJBgUrDgMCGgUABBRZOo132cuo2zNyy+SH2c+pN4OGmQQU2nQao3je7DTj2G6Gge8pooPf2ncCAgfQ"); public static X509Certificate2 GetSampleX509Certificate() { - return new X509Certificate2(SamplePfx, "PLACEHOLDER"); + return new X509Certificate2(SamplePfx, "mono"); } public static Stream LoadResourceStream(string resourceName) From b395a43d90b94c563a871e43d2e45cd1d78de537 Mon Sep 17 00:00:00 2001 From: Jan Jahoda Date: Fri, 19 Mar 2021 13:32:01 +0100 Subject: [PATCH 3/5] Update system.net.testdata --- external/test-runtime/XUnit.Runtime.depproj | 2 +- .../FunctionalTests/System.Net.Http.Functional.Tests.csproj | 2 +- .../Performance/System.Net.Http.Performance.Tests.csproj | 4 ++-- .../tests/FunctionalTests/System.Net.Security.Tests.csproj | 2 +- .../tests/System.Net.WebSockets.Client.Tests.csproj | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/external/test-runtime/XUnit.Runtime.depproj b/external/test-runtime/XUnit.Runtime.depproj index 862d48eb1289..e47d7ae633cc 100644 --- a/external/test-runtime/XUnit.Runtime.depproj +++ b/external/test-runtime/XUnit.Runtime.depproj @@ -78,7 +78,7 @@ 1.0.2-prerelease - 1.0.0-prerelease + 1.0.7 1.0.7 diff --git a/src/System.Net.Http/tests/FunctionalTests/System.Net.Http.Functional.Tests.csproj b/src/System.Net.Http/tests/FunctionalTests/System.Net.Http.Functional.Tests.csproj index b3b9d2437d8a..cf652fd574fa 100644 --- a/src/System.Net.Http/tests/FunctionalTests/System.Net.Http.Functional.Tests.csproj +++ b/src/System.Net.Http/tests/FunctionalTests/System.Net.Http.Functional.Tests.csproj @@ -156,7 +156,7 @@ - + diff --git a/src/System.Net.Http/tests/Performance/System.Net.Http.Performance.Tests.csproj b/src/System.Net.Http/tests/Performance/System.Net.Http.Performance.Tests.csproj index d2948218eabf..a8dc551f76e4 100644 --- a/src/System.Net.Http/tests/Performance/System.Net.Http.Performance.Tests.csproj +++ b/src/System.Net.Http/tests/Performance/System.Net.Http.Performance.Tests.csproj @@ -24,10 +24,10 @@ - + - \ No newline at end of file + diff --git a/src/System.Net.Security/tests/FunctionalTests/System.Net.Security.Tests.csproj b/src/System.Net.Security/tests/FunctionalTests/System.Net.Security.Tests.csproj index bdf707b62d15..d897b25b77d0 100644 --- a/src/System.Net.Security/tests/FunctionalTests/System.Net.Security.Tests.csproj +++ b/src/System.Net.Security/tests/FunctionalTests/System.Net.Security.Tests.csproj @@ -155,7 +155,7 @@ - + diff --git a/src/System.Net.WebSockets.Client/tests/System.Net.WebSockets.Client.Tests.csproj b/src/System.Net.WebSockets.Client/tests/System.Net.WebSockets.Client.Tests.csproj index 4b57c19a4052..1a2165d1ba0a 100644 --- a/src/System.Net.WebSockets.Client/tests/System.Net.WebSockets.Client.Tests.csproj +++ b/src/System.Net.WebSockets.Client/tests/System.Net.WebSockets.Client.Tests.csproj @@ -63,7 +63,7 @@ - + - \ No newline at end of file + From f19ffc212b5b68e74475739eb0a6921548b14bb0 Mon Sep 17 00:00:00 2001 From: Jan Jahoda Date: Thu, 18 Mar 2021 14:39:28 +0100 Subject: [PATCH 4/5] fix UriRelativeResolutionTest.cs --- .../UriRelativeResolutionTest.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/System.Private.Uri/tests/ExtendedFunctionalTests/UriRelativeResolutionTest.cs b/src/System.Private.Uri/tests/ExtendedFunctionalTests/UriRelativeResolutionTest.cs index a1d49da1010c..f62aa41963cd 100644 --- a/src/System.Private.Uri/tests/ExtendedFunctionalTests/UriRelativeResolutionTest.cs +++ b/src/System.Private.Uri/tests/ExtendedFunctionalTests/UriRelativeResolutionTest.cs @@ -14,7 +14,7 @@ public class UriRelativeResolutionTest { // See RFC 3986 Section 5.2.2 and 5.4 http://www.ietf.org/rfc/rfc3986.txt - private readonly Uri _fullBaseUri = new Uri("http://user:psw@host:9090/path1/path2/path3/fileA?query#fragment"); + private readonly Uri _fullBaseUri = new Uri("http://user:PLACEHOLDER@host:9090/path1/path2/path3/fileA?query#fragment"); [Fact] public void Uri_Relative_BaseVsAbsolute_ReturnsFullAbsolute() @@ -391,7 +391,7 @@ public void Uri_Relative_BaseVsSlashTrippleDotSlash_ReturnsSlashTrippleDotSlash( [Fact] public void Uri_Relative_BaseMadeRelativeToSamePath_ReturnsQueryAndFragment() { - Uri compareUri = new Uri("http://user:psw@host:9090/path1/path2/path3/fileA?AQuery#AFragment"); + Uri compareUri = new Uri("http://user:PLACEHOLDER@host:9090/path1/path2/path3/fileA?AQuery#AFragment"); Uri relative = _fullBaseUri.MakeRelativeUri(compareUri); String expectedResult = "?AQuery#AFragment"; // compareUri.GetParts(UriComponents.Query | UriComponents.Fragment,UriFormat.Unescaped); @@ -401,7 +401,7 @@ public void Uri_Relative_BaseMadeRelativeToSamePath_ReturnsQueryAndFragment() [Fact] public void Uri_Relative_BaseMadeRelativeToLastSlash_ReturnsDotSlashPlusQueryAndFragment() { - Uri compareUri = new Uri("http://user:psw@host:9090/path1/path2/path3/?AQuery#AFragment"); + Uri compareUri = new Uri("http://user:PLACEHOLDER@host:9090/path1/path2/path3/?AQuery#AFragment"); Uri relative = _fullBaseUri.MakeRelativeUri(compareUri); Uri reassembled = new Uri(_fullBaseUri, relative); // Symetric @@ -414,7 +414,7 @@ public void Uri_Relative_BaseMadeRelativeToLastSlash_ReturnsDotSlashPlusQueryAnd [Fact] public void Uri_Relative_BaseMadeRelativeToLastSlash_ReturnsDotSlash() { - Uri compareUri = new Uri("http://user:psw@host:9090/path1/path2/path3/"); + Uri compareUri = new Uri("http://user:PLACEHOLDER@host:9090/path1/path2/path3/"); Uri relative = _fullBaseUri.MakeRelativeUri(compareUri); Uri reassembled = new Uri(_fullBaseUri, relative); // Symetric @@ -426,7 +426,7 @@ public void Uri_Relative_BaseMadeRelativeToLastSlash_ReturnsDotSlash() [Fact] public void Uri_Relative_BaseMadeRelativeToLastSlashWithExtra_ReturnsDotSlashPlusQueryAndFragment() { - Uri compareUri = new Uri("http://user:psw@host:9090/path1/path2/path3/Path4/fileb?AQuery#AFragment"); + Uri compareUri = new Uri("http://user:PLACEHOLDER@host:9090/path1/path2/path3/Path4/fileb?AQuery#AFragment"); Uri relative = _fullBaseUri.MakeRelativeUri(compareUri); Uri reassembled = new Uri(_fullBaseUri, relative); // Symetric @@ -438,7 +438,7 @@ public void Uri_Relative_BaseMadeRelativeToLastSlashWithExtra_ReturnsDotSlashPlu [Fact] public void Uri_Relative_BaseMadeRelativeToSecondToLastSlash_ReturnsDoubleDotSlashPlusQueryAndFragment() { - Uri compareUri = new Uri("http://user:psw@host:9090/path1/path2/?AQuery#AFragment"); + Uri compareUri = new Uri("http://user:PLACEHOLDER@host:9090/path1/path2/?AQuery#AFragment"); Uri relative = _fullBaseUri.MakeRelativeUri(compareUri); Uri reassembled = new Uri(_fullBaseUri, relative); // Symetric @@ -450,7 +450,7 @@ public void Uri_Relative_BaseMadeRelativeToSecondToLastSlash_ReturnsDoubleDotSla [Fact] public void Uri_Relative_BaseMadeRelativeToThirdToLastSlash_ReturnsDoubleDoubleDotSlashPlusQueryAndFragment() { - Uri compareUri = new Uri("http://user:psw@host:9090/path1/?AQuery#AFragment"); + Uri compareUri = new Uri("http://user:PLACEHOLDER@host:9090/path1/?AQuery#AFragment"); Uri relative = _fullBaseUri.MakeRelativeUri(compareUri); Uri reassembled = new Uri(_fullBaseUri, relative); // Symetric @@ -462,7 +462,7 @@ public void Uri_Relative_BaseMadeRelativeToThirdToLastSlash_ReturnsDoubleDoubleD [Fact] public void Uri_Relative_BaseMadeRelativeToEmptyPath_ReturnsTrippleDoubleDotSlashPlusQueryAndFragment() { - Uri compareUri = new Uri("http://user:psw@host:9090/?AQuery#AFragment"); + Uri compareUri = new Uri("http://user:PLACEHOLDER@host:9090/?AQuery#AFragment"); Uri relative = _fullBaseUri.MakeRelativeUri(compareUri); Uri reassembled = new Uri(_fullBaseUri, relative); // Symetric From 716caa322423803af28556638feefee249a1ebba Mon Sep 17 00:00:00 2001 From: Jan Jahoda Date: Fri, 19 Mar 2021 21:56:59 +0100 Subject: [PATCH 5/5] Add fix for HttpClientHandlerTest.cs --- .../Deployment/setup_certificates.ps1 | 129 ------------------ .../FunctionalTests/HttpClientHandlerTest.cs | 2 +- 2 files changed, 1 insertion(+), 130 deletions(-) delete mode 100644 src/Common/tests/System/Net/Prerequisites/Deployment/setup_certificates.ps1 diff --git a/src/Common/tests/System/Net/Prerequisites/Deployment/setup_certificates.ps1 b/src/Common/tests/System/Net/Prerequisites/Deployment/setup_certificates.ps1 deleted file mode 100644 index ec7ed4bee100..000000000000 --- a/src/Common/tests/System/Net/Prerequisites/Deployment/setup_certificates.ps1 +++ /dev/null @@ -1,129 +0,0 @@ -# Licensed to the .NET Foundation under one or more agreements. -# The .NET Foundation licenses this file to you under the MIT license. -# See the LICENSE file in the project root for more information. - -#Requires -RunAsAdministrator - -# Certificate configuration - -$script:testDataUri = "https://github.com/dotnet/corefx-testdata/archive/master.zip" -$script:testData = "corefx-testdata" -$script:certificatePath = "$($script:testData)\corefx-testdata-master\System.Net.TestData" - -$script:clientPrivateKeyPath = Join-Path $script:certificatePath "testclient1_at_contoso.com.pfx" -$script:clientPrivateKeyPassword = "testcertificate" - -$script:serverPrivateKeyPath = Join-Path $script:certificatePath "contoso.com.pfx" -$script:serverPrivateKeyPassword = "testcertificate" - -Function GetFullPath($relativePath) -{ - return (Get-Item $relativePath).FullName -} - -Function DeleteTestData -{ - if (Test-Path $script:testData) - { - rmdir $script:testData -Recurse -Force - } - - del ($testData + ".zip") -ErrorAction SilentlyContinue -} - -Function DownloadTestData -{ - DeleteTestData - DownloadFile $script:testDataUri ($testData + ".zip") - Expand-Archive ($testData + ".zip") -} - -Function LoadCertificateAndRoot($fileName, $password) -{ - $privateCerts = New-Object System.Security.Cryptography.X509Certificates.X509Certificate2Collection - $fullPath = GetFullPath $fileName - - $privateCerts.Import($fullPath, $password, ("MachineKeySet", "PersistKeySet", "Exportable")) - - $privateKeyCert = $null - foreach ($cert in $privateCerts) - { - if ($privateKeyCert -eq $null -and $cert.HasPrivateKey) - { - $privateKeyCert = $cert - } - } - - $rootCACert = $privateCerts | where {$_.Subject -eq $privateKeyCert.Issuer} - - return ($privateKeyCert, $rootCACert) -} - -Function AddCertificateToStore($certificate, $storeName, $storeLocation) -{ - $rootStore = New-Object System.Security.Cryptography.X509Certificates.X509Store($storeName, $storeLocation) - $rootStore.Open("ReadWrite") - $rootStore.Add($certificate) - $rootStore.Close() -} - -Function InstallCertificates($fileName, $password) -{ - Write-Host "Acquiring test data." - DownloadTestData - - Write-Host "Adding certificates" - ($private, $root) = LoadCertificateAndRoot $fileName $password - - Write-Host -ForegroundColor DarkGray "`tAdding root certificate: $($root.Subject)" - AddCertificateToStore $root "Root" "LocalMachine" - - Write-Host -ForegroundColor DarkGray "`tAdding private key certificate: $($private.Subject)" - AddCertificateToStore $private "My" "LocalMachine" - - Write-Host "Removing temporary files" - DeleteTestData -} - -Function InstallClientCertificates -{ - Write-Host -ForegroundColor Cyan "Installing Client Certificates" - InstallCertificates $script:clientPrivateKeyPath $script:clientPrivateKeyPassword -} - -Function InstallServerCertificates -{ - Write-Host -ForegroundColor Cyan "Installing Server Certificates" - InstallCertificates $script:serverPrivateKeyPath $script:serverPrivateKeyPassword -} - -Function GetServerCertificate -{ - return dir Cert:\LocalMachine\My | where { $_.DnsNameList | where{$_.Punycode -eq $script:iisServerFQDN} } -} - -Function RemoveCertificates($filename, $password) -{ - Write-Host "Acquiring test data." - DownloadTestData - ($private, $root) = LoadCertificateAndRoot $fileName $password - - Write-Host -ForegroundColor DarkGray "`tRemoving root certificate: $($root.Subject)" - dir Cert:\LocalMachine\Root | where {$_.Subject -eq $root.Subject} | foreach { rm (Join-Path Cert:\LocalMachine\Root $_.Thumbprint) } - Write-Host -ForegroundColor DarkGray "`tRemoving private key certificate: $($private.Subject)" - dir Cert:\LocalMachine\My | where {$_.Subject -eq $private.Subject} | foreach { rm (Join-Path Cert:\LocalMachine\My $_.Thumbprint) -DeleteKey } - - DeleteTestData -} - -Function RemoveClientCertificates -{ - Write-Host -ForegroundColor Cyan "Removing Client Certificates" - RemoveCertificates $script:clientPrivateKeyPath $script:clientPrivateKeyPassword -} - -Function RemoveServerCertificates -{ - Write-Host -ForegroundColor Cyan "Removing Server Certificates" - RemoveCertificates $script:serverPrivateKeyPath $script:serverPrivateKeyPassword -} \ No newline at end of file diff --git a/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.cs b/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.cs index 64fe199d081f..6eda11d3f4fe 100644 --- a/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.cs +++ b/src/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.cs @@ -713,7 +713,7 @@ public async Task GetAsync_ServerNeedsNonStandardAuthAndSetCredential_StatusCode await LoopbackServer.CreateServerAsync(async (server, url) => { HttpClientHandler handler = CreateHttpClientHandler(); - handler.Credentials = new NetworkCredential("unused", "unused"); + handler.Credentials = new NetworkCredential("unused", "PLACEHOLDER"); using (var client = new HttpClient(handler)) { Task getResponseTask = client.GetAsync(url);