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

Commit a61f3b5

Browse files
committed
Add more invalid constructor call tests for X509Certificate2.
TestNullConstructorArguments was written, but missing [Fact]. InvalidCertificateBlob was added to help track down the SegFault in the X509 tests.
1 parent eb986d1 commit a61f3b5

File tree

1 file changed

+7
-0
lines changed
  • src/System.Security.Cryptography.X509Certificates/tests

1 file changed

+7
-0
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ public static void TestByteArrayConstructor()
7171
}
7272
}
7373

74+
[Fact]
7475
public static void TestNullConstructorArguments()
7576
{
7677
Assert.Throws<ArgumentException>(() => new X509Certificate2((byte[])null, (String)null));
@@ -98,5 +99,11 @@ public static void TestNullConstructorArguments()
9899
}
99100
}
100101
}
102+
103+
[Fact]
104+
public static void InvalidCertificateBlob()
105+
{
106+
Assert.Throws<CryptographicException>(() => new X509Certificate2(new byte[] { 0x01, 0x02, 0x03 }));
107+
}
101108
}
102109
}

0 commit comments

Comments
 (0)