Method WithEncryptionLevel
WithEncryptionLevel(EncryptionLevel)
Overrides the TLS encryption setting inferred from the URI scheme.
public ConfigBuilder WithEncryptionLevel(EncryptionLevel level)
Parameters
levelEncryptionLevelEncrypted requires TLS for all connections; None disables TLS.
Returns
- ConfigBuilder
A ConfigBuilder instance for further configuration options.
Remarks
There are three mutually exclusive ways to configure TLS behaviour:
- Use a
+sURI suffix (e.g.bolt+s://,neo4j+s://) — TLS is required and the server certificate must be trusted by the system CA store. - Use a
+sscURI suffix (e.g.bolt+ssc://,neo4j+ssc://) — TLS is required and any certificate is accepted (including self-signed). - Use a plain
bolt://orneo4j://URI and call WithEncryptionLevel(EncryptionLevel) to control TLS, optionally paired with WithTrustManager(TrustManager) or WithCertificateTrustRule(CertificateTrustRule, IReadOnlyList<X509Certificate2>) to configure certificate validation.
These approaches are mutually exclusive. Calling this method has no effect when a +s or
+ssc URI scheme is used, as those schemes already imply a specific TLS and trust policy.