@@ -42,7 +42,7 @@ public void CreateHttpClient_ConfiguresClientCertificate_WhenValidCertificatePro
4242 {
4343 // Create a self-signed certificate for testing
4444 using var cert = CreateSelfSignedCertificate ( ) ;
45- var certBytes = cert . Export ( System . Security . Cryptography . X509Certificates . X509ContentType . Pfx ) ;
45+ var certBytes = cert . Export ( X509ContentType . Pfx ) ;
4646 File . WriteAllBytes ( tempCertFile , certBytes ) ;
4747
4848 var options = new OtlpMtlsOptions
@@ -86,6 +86,7 @@ public void CreateHttpClient_ConfiguresServerCertificateValidation_WhenTrustedRo
8686 var options = new OtlpMtlsOptions
8787 {
8888 CaCertificatePath = tempTrustStoreFile ,
89+ EnableCertificateChainValidation = false , // Avoid platform-specific chain build differences
8990 } ;
9091
9192 using var httpClient = OpenTelemetryProtocol . Implementation . OtlpMtlsHttpClientFactory . CreateMtlsHttpClient ( options ) ;
@@ -123,6 +124,7 @@ public void CreateHttpClient_ConfiguresServerValidation_WithCaOnly()
123124 var options = new OtlpMtlsOptions
124125 {
125126 CaCertificatePath = tempTrustStoreFile ,
127+ EnableCertificateChainValidation = false , // Avoid platform-specific chain build differences
126128 } ;
127129
128130 using var httpClient = OpenTelemetryProtocol . Implementation . OtlpMtlsHttpClientFactory . CreateMtlsHttpClient ( options ) ;
@@ -222,14 +224,14 @@ public void CreateMtlsHttpClient_ThrowsArgumentNullException_WhenOptionsIsNull()
222224 Assert . Equal ( "mtlsOptions" , exception . ParamName ) ;
223225 }
224226
225- private static System . Security . Cryptography . X509Certificates . X509Certificate2 CreateSelfSignedCertificate ( )
227+ private static X509Certificate2 CreateSelfSignedCertificate ( )
226228 {
227- using var rsa = System . Security . Cryptography . RSA . Create ( 2048 ) ;
228- var req = new System . Security . Cryptography . X509Certificates . CertificateRequest (
229+ using var rsa = RSA . Create ( 2048 ) ;
230+ var req = new CertificateRequest (
229231 "CN=Test Certificate" ,
230232 rsa ,
231- System . Security . Cryptography . HashAlgorithmName . SHA256 ,
232- System . Security . Cryptography . RSASignaturePadding . Pkcs1 ) ;
233+ HashAlgorithmName . SHA256 ,
234+ RSASignaturePadding . Pkcs1 ) ;
233235
234236 var cert = req . CreateSelfSigned (
235237 DateTimeOffset . UtcNow . AddDays ( - 1 ) ,
0 commit comments