1010namespace OpenTelemetry . Exporter . OpenTelemetryProtocol . Implementation ;
1111
1212/// <summary>
13- /// Manages certificate loading, validation, and security checks for mTLS connections.
13+ /// Manages certificate loading, validation, and security checks for TLS connections.
1414/// </summary>
15- internal static class OtlpMtlsCertificateManager
15+ /// <remarks>
16+ /// This class provides functionality for both simple server certificate trust
17+ /// (for self-signed certificates) and mTLS client authentication scenarios.
18+ /// </remarks>
19+ internal static class OtlpCertificateManager
1620{
1721 internal const string CaCertificateType = "CA certificate" ;
1822 internal const string ClientCertificateType = "Client certificate" ;
@@ -21,8 +25,8 @@ internal static class OtlpMtlsCertificateManager
2125 /// <summary>
2226 /// Loads a CA certificate from a PEM file.
2327 /// </summary>
24- /// <param name="caCertificatePath">Path to the CA certificate file.</param>
25- /// <returns>The loaded CA certificate.</returns>
28+ /// <param name="caCertificatePath">Path to the certificate file.</param>
29+ /// <returns>The loaded certificate.</returns>
2630 /// <exception cref="FileNotFoundException">Thrown when the certificate file is not found.</exception>
2731 /// <exception cref="InvalidOperationException">Thrown when the certificate cannot be loaded.</exception>
2832 public static X509Certificate2 LoadCaCertificate ( string caCertificatePath )
@@ -218,6 +222,10 @@ public static bool ValidateCertificateChain(
218222 /// <param name="sslPolicyErrors">The SSL policy errors.</param>
219223 /// <param name="caCertificate">The CA certificate to validate against.</param>
220224 /// <returns>True if the certificate is valid; otherwise, false.</returns>
225+ /// <remarks>
226+ /// This method is used to validate server certificates against a CA certificate.
227+ /// Common use case: connecting to a server with a self-signed certificate.
228+ /// </remarks>
221229 internal static bool ValidateServerCertificate (
222230 X509Certificate2 serverCert ,
223231 X509Chain chain ,
@@ -232,7 +240,7 @@ internal static bool ValidateServerCertificate(
232240 return true ;
233241 }
234242
235- // If the only error is an untrusted root, validate against our CA
243+ // If the only error is an untrusted root, validate against our CA certificate
236244 if ( sslPolicyErrors . HasFlag ( SslPolicyErrors . RemoteCertificateChainErrors ) )
237245 {
238246 // Add our CA certificate to the chain
@@ -248,7 +256,7 @@ internal static bool ValidateServerCertificate(
248256
249257 if ( isValid )
250258 {
251- // Verify that the chain terminates with our CA
259+ // Verify that the chain terminates with our CA certificate
252260 var rootCert = chain . ChainElements [ ^ 1 ] . Certificate ;
253261 if (
254262 string . Equals (
0 commit comments