Interface ISchemaRegistrySslBuilder
Fluent builder interface for configuring Schema Registry SSL/TLS settings.
public interface ISchemaRegistrySslBuilder
- Extension Methods
Examples
kafka.UseConfluentSchemaRegistry(registry =>
{
registry.SchemaRegistryUrl("https://registry.example.com:8085")
.ConfigureSsl(ssl =>
{
ssl.EnableCertificateVerification(true)
.CaCertificateLocation("/path/to/ca.crt")
.ClientKeystore("/path/to/client.p12", keystorePassword);
});
});
Remarks
This builder configures mutual TLS (mTLS) authentication between the Kafka client
and the Schema Registry. All methods return this for fluent chaining.
Methods
CaCertificateLocation(string)
Sets the location of the CA certificate for verifying the server certificate.
ISchemaRegistrySslBuilder CaCertificateLocation(string path)
Parameters
pathstringThe file path to the CA certificate (PEM format).
Returns
- ISchemaRegistrySslBuilder
The builder for fluent chaining.
Exceptions
- ArgumentException
Thrown when
pathis null or whitespace.
ClientKeystore(string, string)
Sets the client keystore presented to the Schema Registry for mutual TLS authentication.
ISchemaRegistrySslBuilder ClientKeystore(string path, string password)
Parameters
pathstringThe file path to a PKCS#12 (
.p12/.pfx) keystore holding the client certificate and its private key.passwordstringThe password protecting the keystore.
Returns
- ISchemaRegistrySslBuilder
The builder for fluent chaining.
Remarks
A keystore, not a certificate/key pair: the Schema Registry client accepts client credentials only
in that form. Convert an existing PEM pair with
openssl pkcs12 -export -in client.crt -inkey client.key -out client.p12.
What this defends and what it does not. It authenticates this client TO the registry, so a registry configured to require client certificates will reject callers that present none. It says nothing about the Kafka broker connection, which carries its own posture, and nothing about the authenticity of the registry itself — that is EnableCertificateVerification(bool) together with CaCertificateLocation(string), and disabling verification leaves the connection encrypted but unauthenticated.
Exceptions
- ArgumentException
Thrown when
pathorpasswordis null or whitespace.
EnableCertificateVerification(bool)
Enables or disables SSL certificate verification.
ISchemaRegistrySslBuilder EnableCertificateVerification(bool enable = true)
Parameters
enableboolWhether to verify SSL certificates. Default is true.
Returns
- ISchemaRegistrySslBuilder
The builder for fluent chaining.
Remarks
Only disable certificate verification in development/testing environments. Production deployments should always verify certificates.