using System.Formats.Asn1;
using System.Linq;
+using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using Test.Cryptography;
using Xunit;
X509ChainStatusFlags intermediateErrors,
X509ChainStatusFlags rootErrors)
{
+ string testName = $"{nameof(BuildInvalidSignatureTwice)} {endEntityErrors} {intermediateErrors} {rootErrors}";
TestDataGenerator.MakeTestChain3(
out X509Certificate2 endEntityCert,
out X509Certificate2 intermediateCert,
- out X509Certificate2 rootCert);
+ out X509Certificate2 rootCert,
+ testName: testName);
X509Certificate2 TamperIfNeeded(X509Certificate2 input, X509ChainStatusFlags flags)
{
bool saveAllInCustomTrustStore,
X509ChainStatusFlags chainFlags)
{
+ string testName = $"{nameof(CustomRootTrustDoesNotTrustIntermediates)} {saveAllInCustomTrustStore} {chainFlags}";
TestDataGenerator.MakeTestChain3(
out X509Certificate2 endEntityCert,
out X509Certificate2 intermediateCert,
- out X509Certificate2 rootCert);
+ out X509Certificate2 rootCert,
+ testName: testName);
using (endEntityCert)
using (intermediateCert)
private static void TestNameConstrainedChain(
string intermediateNameConstraints,
SubjectAlternativeNameBuilder endEntitySanBuilder,
- Action<bool, X509Chain> body)
+ Action<bool, X509Chain> body,
+ [CallerMemberName] string testName = null)
{
X509Extension[] endEntityExtensions = new []
{
out X509Certificate2 intermediateCert,
out X509Certificate2 rootCert,
intermediateExtensions: intermediateExtensions,
- endEntityExtensions: endEntityExtensions);
+ endEntityExtensions: endEntityExtensions,
+ testName: testName);
using (endEntityCert)
using (intermediateCert)
// The .NET Foundation licenses this file to you under the MIT license.
using System.Collections.Generic;
+using System.Runtime.CompilerServices;
namespace System.Security.Cryptography.X509Certificates.Tests
{
out X509Certificate2 rootCert,
IEnumerable<X509Extension> endEntityExtensions = null,
IEnumerable<X509Extension> intermediateExtensions = null,
- IEnumerable<X509Extension> rootExtensions = null)
+ IEnumerable<X509Extension> rootExtensions = null,
+ [CallerMemberName] string testName = null)
{
using (RSA rootKey = RSA.Create())
using (RSA intermediateKey = RSA.Create())
certs,
endEntityExtensions,
intermediateExtensions,
- rootExtensions);
+ rootExtensions,
+ testName);
endEntityCert = certs[0];
intermediateCert = certs[1];
out X509Certificate2 rootCert,
IEnumerable<X509Extension> endEntityExtensions = null,
IEnumerable<X509Extension> intermediateExtensions = null,
- IEnumerable<X509Extension> rootExtensions = null)
+ IEnumerable<X509Extension> rootExtensions = null,
+ [CallerMemberName] string testName = null)
{
using (RSA rootKey = RSA.Create())
using (RSA intermediateKey = RSA.Create())
certs,
endEntityExtensions,
intermediateExtensions,
- rootExtensions);
+ rootExtensions,
+ testName);
endEntityCert = certs[0];
intermediateCert1 = certs[1];
Span<X509Certificate2> certs,
IEnumerable<X509Extension> endEntityExtensions,
IEnumerable<X509Extension> intermediateExtensions,
- IEnumerable<X509Extension> rootExtensions)
+ IEnumerable<X509Extension> rootExtensions,
+ string testName)
{
if (keys.Length < 2)
throw new ArgumentException(nameof(keys));
RSASignaturePadding signaturePadding = RSASignaturePadding.Pkcs1;
CertificateRequest rootReq = new CertificateRequest(
- "CN=Test Root",
+ $"CN=Test Root, O=\"{testName}\"",
keys[rootIndex],
hashAlgorithm,
signaturePadding);
presentationNumber++;
CertificateRequest intermediateReq = new CertificateRequest(
- $"CN=Intermediate Layer {presentationNumber}",
+ $"CN=Intermediate Layer {presentationNumber}, O=\"{testName}\"",
keys[i],
hashAlgorithm,
signaturePadding);
}
CertificateRequest eeReq = new CertificateRequest(
- "CN=End-Entity",
+ $"CN=End-Entity, O=\"{testName}\"",
keys[0],
hashAlgorithm,
signaturePadding);