Uh oh!
There was an error while loading. Please reload this page.
add mTLS support - #60
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds TLS/mTLS configuration to the IoTDB C# client, exposing client certificate + custom root CA options through both the fluent SessionPool/TableSessionPool builders and ADO.NET connection strings, and documenting how to map Java/keytool outputs to the .NET certificate model.
Changes:
- Extend
SessionPooland both builders to acceptClientCertificatePath,ClientCertificatePassword, andRootCertificatePath, and wire these into TLS transport creation and validation. - Add ADO.NET connection string keywords (
UseSsl,ClientCertificatePath,ClientCertificatePassword,RootCertificatePath) and update session creation to use the builder pipeline. - Add documentation (EN/ZH) and configuration-focused tests for the new options.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Apache.IoTDB.Tests/MtlsConfigurationTests.cs | Adds tests asserting the new builder and connection-string configuration surfaces accept mTLS/TLS options. |
| tests/Apache.IoTDB.Tests/Apache.IoTDB.Tests.csproj | References Apache.IoTDB.Data to enable testing the ADO.NET connection string builder. |
| src/Apache.IoTDB/TableSessionPool.Builder.cs | Adds client/root certificate configuration to the table session pool builder and forwards into SessionPool. |
| src/Apache.IoTDB/SessionPool.cs | Implements certificate loading, custom root CA validation callback, and client cert selection for TLS sockets. |
| src/Apache.IoTDB/SessionPool.Builder.cs | Adds client/root certificate configuration to the main session pool builder and forwards into SessionPool. |
| src/Apache.IoTDB.Data/IoTDBConnectionStringBuilder.cs | Adds new connection string keywords/properties for TLS/mTLS, and fixes TimeOut setter serialization. |
| src/Apache.IoTDB.Data/DataReaderExtensions.cs | Routes ADO.NET session creation through SessionPool.Builder() so TLS/mTLS options are applied. |
| README.md | Documents TLS/mTLS usage and keytool artifact mapping; provides builder + connection string examples. |
| README_ZH.md | Chinese version of the TLS/mTLS documentation and examples. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| public Builder SetClientCertificatePath(string clientCertificatePath) | ||
| { | ||
| _certificatePath = certificatePath; | ||
| _clientCertificatePath = clientCertificatePath; | ||
| return this; | ||
| } |
| public Builder SetClientCertificatePath(string clientCertificatePath) | ||
| { | ||
| _certificatePath = certificatePath; | ||
| _clientCertificatePath = clientCertificatePath; | ||
| return this; | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| public Builder SetClientCertificatePath(string clientCertificatePath) | ||
| { | ||
| _certificatePath = certificatePath; | ||
| _clientCertificatePath = clientCertificatePath; | ||
| return this; | ||
| } |
| public Builder SetClientCertificatePath(string clientCertificatePath) | ||
| { | ||
| _certificatePath = certificatePath; | ||
| _clientCertificatePath = clientCertificatePath; | ||
| return this; | ||
| } |
| | keytool artifact | C# client usage | | ||
| | --- | --- | | ||
| | `ca.crt` | Pass to `SetRootCertificatePath` / `RootCertificatePath` to trust the server certificate | | ||
| | `client.keystore` | Contains the client private key and certificate chain; JDK 17 creates PKCS#12 by default, so pass it directly to `SetClientCertificatePath` | |
Uh oh!
There was an error while loading. Please reload this page.
Summary
ClientCertificatePath,ClientCertificatePassword, andRootCertificatePathoptions.SessionPool, including ADO.NET connection string support.client.keystoreandca.crt.Impact
Users can now configure one-way TLS with a private CA and mTLS client certificates through both the fluent builders and ADO.NET connection strings. The documented Java/keytool workflow now maps directly to the C# parameters.
Validation
git diff --checkdotnet build tests/Apache.IoTDB.Tests/Apache.IoTDB.Tests.csproj -f net5.0 --no-restore -v:minimal -clp:ErrorsOnly