Table of Contents

Method WithTrustManager

Namespace
Neo4j.Driver
Assembly
Neo4j.Driver.dll

WithTrustManager(TrustManager)

Sets a custom TrustManager for validating server TLS certificates. Has no effect if TLS is not enabled (i.e. EncryptionLevel is None and the URI scheme does not require encryption).

public ConfigBuilder WithTrustManager(TrustManager manager)

Parameters

manager TrustManager

A TrustManager instance. Use the factory methods on TrustManager (such as CreateChainTrust(bool, X509RevocationMode, X509RevocationFlag, bool) or CreateCertTrust(IEnumerable<X509Certificate2>, bool)) to create an appropriate instance, or subclass TrustManager for fully custom behaviour.

Returns

ConfigBuilder

A ConfigBuilder instance for further configuration options.

Remarks

For most use cases, prefer WithCertificateTrustRule(CertificateTrustRule, IReadOnlyList<X509Certificate2>), which provides a simpler API for the common trust scenarios.

This method only applies when using a plain bolt:// or neo4j:// URI with TLS enabled via WithEncryptionLevel(EncryptionLevel). When using a +s or +ssc URI scheme, the trust policy is already determined by the scheme and this setting is ignored.