Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit d77c30c

Browse files
committed
Enable file-load tests for X509Certificates
For the Unix implementation the removal of the 1977 ActiveIssue required adding the 1993 ActiveIssue, since file-load is not yet implemented for the Unix builds.
1 parent baaa017 commit d77c30c

File tree

7 files changed

+54
-20
lines changed

7 files changed

+54
-20
lines changed

src/System.Security.Cryptography.X509Certificates/tests/CertTests.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ namespace System.Security.Cryptography.X509Certificates.Tests
1010
public static class CertTests
1111
{
1212
[Fact]
13-
[ActiveIssue(1977, PlatformID.Any)]
13+
[ActiveIssue(1993, PlatformID.AnyUnix)]
1414
public static void X509CertTest()
1515
{
1616
const string CertSubject =
1717
@"CN=Microsoft Corporate Root Authority, OU=ITG, O=Microsoft, L=Redmond, S=WA, C=US, [email protected]";
1818

19-
using (X509Certificate cert = new X509Certificate("microsoft.cer"))
19+
using (X509Certificate cert = new X509Certificate("TestData\\microsoft.cer"))
2020
{
2121
Assert.Equal(CertSubject, cert.Subject);
2222
Assert.Equal(CertSubject, cert.Issuer);
@@ -50,13 +50,13 @@ public static void X509CertTest()
5050
}
5151

5252
[Fact]
53-
[ActiveIssue(1977, PlatformID.Any)]
53+
[ActiveIssue(1993, PlatformID.AnyUnix)]
5454
public static void X509Cert2Test()
5555
{
5656
const string CertName =
5757
@"[email protected], CN=ABA.ECOM Root CA, O=""ABA.ECOM, INC."", L=Washington, S=DC, C=US";
5858

59-
using (X509Certificate2 cert2 = new X509Certificate2("test.cer"))
59+
using (X509Certificate2 cert2 = new X509Certificate2("TestData\\test.cer"))
6060
{
6161
Assert.Equal(CertName, cert2.IssuerName.Name);
6262
Assert.Equal(CertName, cert2.SubjectName.Name);
@@ -118,21 +118,21 @@ public static void X509Cert2ToStringVerbose()
118118
}
119119

120120
[Fact]
121-
[ActiveIssue(1977, PlatformID.Any)]
121+
[ActiveIssue(1993, PlatformID.AnyUnix)]
122122
public static void X509Cert2CreateFromPfxFile()
123123
{
124-
using (X509Certificate2 cert2 = new X509Certificate2("DummyTcpServer.pfx"))
124+
using (X509Certificate2 cert2 = new X509Certificate2("TestData\\DummyTcpServer.pfx"))
125125
{
126126
// OID=RSA Encryption
127127
Assert.Equal("1.2.840.113549.1.1.1", cert2.GetKeyAlgorithm());
128128
}
129129
}
130130

131131
[Fact]
132-
[ActiveIssue(1977, PlatformID.Any)]
132+
[ActiveIssue(1993, PlatformID.AnyUnix)]
133133
public static void X509Cert2CreateFromPfxWithPassword()
134134
{
135-
using (X509Certificate2 cert2 = new X509Certificate2("test.pfx", "test"))
135+
using (X509Certificate2 cert2 = new X509Certificate2("TestData\\test.pfx", "test"))
136136
{
137137
// OID=RSA Encryption
138138
Assert.Equal("1.2.840.113549.1.1.1", cert2.GetKeyAlgorithm());

src/System.Security.Cryptography.X509Certificates/tests/CollectionTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ public static void ImportStoreSavedAsPfxData()
268268
}
269269

270270
[Fact]
271-
[ActiveIssue(1977, PlatformID.Any)]
271+
[ActiveIssue(1993, PlatformID.AnyUnix)]
272272
public static void ImportFromFileTests()
273273
{
274274
using (var pfxCer = new X509Certificate2(TestData.PfxData, TestData.PfxDataPassword))

src/System.Security.Cryptography.X509Certificates/tests/LoadFromFileTests.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace System.Security.Cryptography.X509Certificates.Tests
1010
public static class LoadFromFileTests
1111
{
1212
[Fact]
13-
[ActiveIssue(1977, PlatformID.Any)]
13+
[ActiveIssue(1993, PlatformID.AnyUnix)]
1414
public static void TestIssuer()
1515
{
1616
using (X509Certificate2 c = LoadCertificateFromFile())
@@ -24,7 +24,7 @@ public static void TestIssuer()
2424
}
2525

2626
[Fact]
27-
[ActiveIssue(1977, PlatformID.Any)]
27+
[ActiveIssue(1993, PlatformID.AnyUnix)]
2828
public static void TestSubject()
2929
{
3030
using (X509Certificate2 c = LoadCertificateFromFile())
@@ -38,7 +38,7 @@ public static void TestSubject()
3838
}
3939

4040
[Fact]
41-
[ActiveIssue(1977, PlatformID.Any)]
41+
[ActiveIssue(1993, PlatformID.AnyUnix)]
4242
public static void TestSerial()
4343
{
4444
byte[] expectedSerial = "b00000000100dd9f3bd08b0aaf11b000000033".HexToByteArray();
@@ -51,7 +51,7 @@ public static void TestSerial()
5151
}
5252

5353
[Fact]
54-
[ActiveIssue(1977, PlatformID.Any)]
54+
[ActiveIssue(1993, PlatformID.AnyUnix)]
5555
public static void TestThumbprint()
5656
{
5757
byte[] expectedThumbPrint = "108e2ba23632620c427c570b6d9db51ac31387fe".HexToByteArray();
@@ -64,7 +64,7 @@ public static void TestThumbprint()
6464
}
6565

6666
[Fact]
67-
[ActiveIssue(1977, PlatformID.Any)]
67+
[ActiveIssue(1993, PlatformID.AnyUnix)]
6868
public static void TestGetFormat()
6969
{
7070
using (X509Certificate2 c = LoadCertificateFromFile())
@@ -75,7 +75,7 @@ public static void TestGetFormat()
7575
}
7676

7777
[Fact]
78-
[ActiveIssue(1977, PlatformID.Any)]
78+
[ActiveIssue(1993, PlatformID.AnyUnix)]
7979
public static void TestGetKeyAlgorithm()
8080
{
8181
using (X509Certificate2 c = LoadCertificateFromFile())
@@ -86,7 +86,7 @@ public static void TestGetKeyAlgorithm()
8686
}
8787

8888
[Fact]
89-
[ActiveIssue(1977, PlatformID.Any)]
89+
[ActiveIssue(1993, PlatformID.AnyUnix)]
9090
public static void TestGetKeyAlgorithmParameters()
9191
{
9292
string expected = "0500";
@@ -101,7 +101,7 @@ public static void TestGetKeyAlgorithmParameters()
101101
}
102102

103103
[Fact]
104-
[ActiveIssue(1977, PlatformID.Any)]
104+
[ActiveIssue(1993, PlatformID.AnyUnix)]
105105
public static void TestGetPublicKey()
106106
{
107107
byte[] expectedPublicKey = (
@@ -123,7 +123,7 @@ public static void TestGetPublicKey()
123123
}
124124

125125
[Fact]
126-
[ActiveIssue(1977, PlatformID.Any)]
126+
[ActiveIssue(1993, PlatformID.AnyUnix)]
127127
public static void TestLoadSignedFile()
128128
{
129129
// X509Certificate2 can also extract the certificate from a signed file.

src/System.Security.Cryptography.X509Certificates/tests/PfxTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ public static void TestSetPrivateKey()
118118
}
119119

120120
[Fact]
121-
[ActiveIssue(1977, PlatformID.Any)]
121+
[ActiveIssue(1993, PlatformID.AnyUnix)]
122122
public static void TestContentType()
123123
{
124124
String fileName = @"TestData\My.pfx";

src/System.Security.Cryptography.X509Certificates/tests/System.Security.Cryptography.X509Certificates.Tests.csproj

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,19 @@
3939
<None Include="project.json" />
4040
</ItemGroup>
4141
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
42+
<!-- Temporary until we have new work in build tools to
43+
deploy content from nuget packages -->
44+
<Target Name="CopyX509TestDataToTestDirectory" AfterTargets="CopyTestToTestDirectory" Inputs="$(PackagesDir)$(X509TestPackage)\content" Outputs="$(TestPath)%(TestTargetFramework.Folder)\*.*">
45+
<PropertyGroup>
46+
<X509TestPackage>System.Security.Cryptography.X509Certificates.TestData\1.0.0-prerelease</X509TestPackage>
47+
<TestTargetFrameworkFolder>%(TestTargetFramework.Folder)</TestTargetFrameworkFolder>
48+
</PropertyGroup>
49+
<ItemGroup>
50+
<X509TestDataSrc Include="$(PackagesDir)$(X509TestPackage)\content\**\*.*" />
51+
<X509TestDataDest Include="@(X509TestDataSrc->'$(TestPath)$(TestTargetFrameworkFolder)\%(RecursiveDir)%(Filename)%(Extension)')" />
52+
</ItemGroup>
53+
<Copy SourceFiles="@(X509TestDataSrc)" DestinationFiles="@(X509TestDataDest)" SkipUnchangedFiles="$(SkipCopyUnchangedFiles)" OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)" Retries="$(CopyRetryCount)" RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)" UseHardlinksIfPossible="$(CreateHardLinksForCopyFilesToOutputDirectoryIfPossible)">
54+
<Output TaskParameter="DestinationFiles" ItemName="FileWrites" />
55+
</Copy>
56+
</Target>
4257
</Project>

src/System.Security.Cryptography.X509Certificates/tests/project.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"System.Security.Cryptography.Encoding": "4.0.0-beta-*",
99
"System.Security.Cryptography.Encryption": "4.0.0-beta-*",
1010
"System.Security.Cryptography.RSA": "4.0.0-beta-*",
11+
"System.Security.Cryptography.X509Certificates.TestData": "1.0.0-prerelease",
1112
"xunit": "2.0.0-beta5-build2785",
1213
"xunit.abstractions.netcore": "1.0.0-prerelease",
1314
"xunit.assert": "2.0.0-beta5-build2785",

src/System.Security.Cryptography.X509Certificates/tests/project.lock.json

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,7 @@
313313
"lib/DNXCore50/System.Security.Cryptography.RSA.dll"
314314
]
315315
},
316+
"System.Security.Cryptography.X509Certificates.TestData/1.0.0-prerelease": {},
316317
"System.Text.Encoding/4.0.10-beta-23008": {
317318
"dependencies": {
318319
"System.Runtime": "4.0.0-beta-23008"
@@ -757,6 +758,22 @@
757758
"ref/net46/System.Security.Cryptography.RSA.dll"
758759
]
759760
},
761+
"System.Security.Cryptography.X509Certificates.TestData/1.0.0-prerelease": {
762+
"sha512": "UbpXPyovZcwfKhYg/O85pLjFEO3hkrEjCLGus7P9y45Peoqrfc8XKzdCW5k5WIDCtLw9M1PJHGlOFV/U0D1tkg==",
763+
"files": [
764+
"System.Security.Cryptography.X509Certificates.TestData.1.0.0-prerelease.nupkg",
765+
"System.Security.Cryptography.X509Certificates.TestData.1.0.0-prerelease.nupkg.sha512",
766+
"System.Security.Cryptography.X509Certificates.TestData.nuspec",
767+
"content/TestData/DummyTcpServer.pfx",
768+
"content/TestData/microsoft.cer",
769+
"content/TestData/MS.cer",
770+
"content/TestData/My.cer",
771+
"content/TestData/My.pfx",
772+
"content/TestData/test.cer",
773+
"content/TestData/test.pfx",
774+
"content/TestData/Windows6.1-KB3004361-x64.msu"
775+
]
776+
},
760777
"System.Text.Encoding/4.0.10-beta-23008": {
761778
"sha512": "dDcnfqdj6stUj1o1mNZIxEDTI0er7TVER+CVcng+6rEejErS5HQjIEsuEepQSiAF3VDiZu8ZI89RAUuQbCSjEw==",
762779
"files": [
@@ -952,6 +969,7 @@
952969
"System.Security.Cryptography.Encoding >= 4.0.0-beta-*",
953970
"System.Security.Cryptography.Encryption >= 4.0.0-beta-*",
954971
"System.Security.Cryptography.RSA >= 4.0.0-beta-*",
972+
"System.Security.Cryptography.X509Certificates.TestData >= 1.0.0-prerelease",
955973
"xunit >= 2.0.0-beta5-build2785",
956974
"xunit.abstractions.netcore >= 1.0.0-prerelease",
957975
"xunit.assert >= 2.0.0-beta5-build2785",
@@ -961,4 +979,4 @@
961979
],
962980
"DNXCore,Version=v5.0": []
963981
}
964-
}
982+
}

0 commit comments

Comments
 (0)