Class MtlsCertificatePair

Namespace
Kuestenlogik.Bowire.Auth
Assembly
Kuestenlogik.Bowire.dll

Disposable wrapper for the client- and (optional) CA-certificate pair produced by TryLoadCertificates(out string?). Callers use a using declaration so the analyzer can see disposal on every exit path; once ownership of the inner X509 resources has been handed off to a long-lived owner (MtlsHandlerOwner, MtlsCertOwner), Release() turns the wrapper's own Dispose into a no-op so the certificates aren't torn down with the pair going out of scope. Cleaner than three out parameters plus a CA2000 suppression at every call site.

public sealed class MtlsCertificatePair : IDisposable
Inheritance
MtlsCertificatePair
Implements
Inherited Members

Properties

CaCert

The PEM-decoded CA certificate when CaCertificatePem was supplied, otherwise null.

public X509Certificate2? CaCert { get; }

Property Value

X509Certificate2

ClientCert

The PEM-decoded client certificate. Non-null until Release() or Dispose() runs.

public X509Certificate2 ClientCert { get; }

Property Value

X509Certificate2

Methods

Dispose()

public void Dispose()

Release()

Hand ownership of the inner X509 resources to the caller — disposing the pair afterwards is a no-op. Invoked from MtlsHandlerOwner + MtlsCertOwner factories once the long-lived owner has taken responsibility for the certs.

public void Release()