Skip to content

add mTLS support - #60

Open
HTHou wants to merge 5 commits into
mainfrom
codex/add-mtls-support
Open

add mTLS support#60
HTHou wants to merge 5 commits into
mainfrom
codex/add-mtls-support

Conversation

@HTHou

Copy link
Copy Markdown
Contributor

Summary

  • Add mTLS configuration to the C# client with ClientCertificatePath, ClientCertificatePassword, and RootCertificatePath options.
  • Wire TLS certificate loading and custom CA validation into SessionPool, including ADO.NET connection string support.
  • Document the JDK 17/keytool artifact mapping for C# users, including direct use of client.keystore and ca.crt.
  • Add configuration tests for the new builder and connection string options.

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 --check
  • dotnet build tests/Apache.IoTDB.Tests/Apache.IoTDB.Tests.csproj -f net5.0 --no-restore -v:minimal -clp:ErrorsOnly

@HTHouHTHou changed the title [codex] add mTLS supportadd mTLS supportJun 26, 2026
@HTHou
HTHou marked this pull request as ready for review June 29, 2026 09:34
@HTHou
HTHou requested a review from CopilotJune 30, 2026 10:48

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 SessionPool and both builders to accept ClientCertificatePath, ClientCertificatePassword, and RootCertificatePath, 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
FileDescription
tests/Apache.IoTDB.Tests/MtlsConfigurationTests.csAdds tests asserting the new builder and connection-string configuration surfaces accept mTLS/TLS options.
tests/Apache.IoTDB.Tests/Apache.IoTDB.Tests.csprojReferences Apache.IoTDB.Data to enable testing the ADO.NET connection string builder.
src/Apache.IoTDB/TableSessionPool.Builder.csAdds client/root certificate configuration to the table session pool builder and forwards into SessionPool.
src/Apache.IoTDB/SessionPool.csImplements certificate loading, custom root CA validation callback, and client cert selection for TLS sockets.
src/Apache.IoTDB/SessionPool.Builder.csAdds client/root certificate configuration to the main session pool builder and forwards into SessionPool.
src/Apache.IoTDB.Data/IoTDBConnectionStringBuilder.csAdds new connection string keywords/properties for TLS/mTLS, and fixes TimeOut setter serialization.
src/Apache.IoTDB.Data/DataReaderExtensions.csRoutes ADO.NET session creation through SessionPool.Builder() so TLS/mTLS options are applied.
README.mdDocuments TLS/mTLS usage and keytool artifact mapping; provides builder + connection string examples.
README_ZH.mdChinese version of the TLS/mTLS documentation and examples.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment threadsrc/Apache.IoTDB/SessionPool.cs
Comment threadsrc/Apache.IoTDB/SessionPool.cs Outdated
Comment threadsrc/Apache.IoTDB/SessionPool.cs Outdated
Comment on lines +105 to +109
public Builder SetClientCertificatePath(string clientCertificatePath)
{
_certificatePath = certificatePath;
_clientCertificatePath = clientCertificatePath;
return this;
}
Comment on lines +108 to +112
public Builder SetClientCertificatePath(string clientCertificatePath)
{
_certificatePath = certificatePath;
_clientCertificatePath = clientCertificatePath;
return this;
}
Comment threadREADME.md
Comment threadREADME.md
Comment threadREADME_ZH.md
Comment threadREADME_ZH.md

CopilotAI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.

Comment on lines +105 to +109
public Builder SetClientCertificatePath(string clientCertificatePath)
{
_certificatePath = certificatePath;
_clientCertificatePath = clientCertificatePath;
return this;
}
Comment on lines +108 to +112
public Builder SetClientCertificatePath(string clientCertificatePath)
{
_certificatePath = certificatePath;
_clientCertificatePath = clientCertificatePath;
return this;
}
Comment threadREADME.md Outdated
| 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` |
Comment threadREADME_ZH.md Outdated
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

@HTHou