Table of Contents

Class TrustManager

Namespace
Neo4j.Driver
Assembly
Neo4j.Driver.dll

Base class for TLS trust managers. A trust manager decides whether to accept a server's TLS certificate during connection establishment.

public abstract class TrustManager
Inheritance
TrustManager
Inherited Members
Extension Methods

Remarks

For most use cases, certificate trust is configured through the URI scheme rather than a TrustManager. Use bolt+s:// or neo4j+s:// for standard CA-based trust, or bolt+ssc:// / neo4j+ssc:// to accept self-signed server certificates.

Use a TrustManager (via WithTrustManager(TrustManager)) when you need fine-grained control over certificate validation beyond what the URI scheme provides — for example, to pin specific CA certificates or customise revocation checking.

Methods

CreateCertTrust(IEnumerable<X509Certificate2>, bool)

Creates a trust manager that validates server certificates against a provided list of trusted CA certificates. Use this when connecting to a server whose certificate was issued by a private or self-managed CA.

CreateChainTrust(bool, X509RevocationMode, X509RevocationFlag, bool)

Creates a trust manager that validates server certificates against the operating system's trusted CA stores. This is the recommended option for production environments where the server has a certificate issued by a well-known CA.

CreateInsecure(bool)

Creates a trust manager that accepts any certificate without validation.

CreatePeerTrust(bool, bool)

Creates a trust manager that validates server certificates against the TrustedPeople system certificate store.

ValidateServerCertificate(Uri, X509Certificate2, X509Chain, SslPolicyErrors)

Returns whether the endpoint should be trusted or not.