Skip to content

Conversation

@HTHou
Copy link
Contributor

@HTHou HTHou commented Jan 9, 2026

  1. Genarate keystore
keytool -genkeypair -alias mykey -keyalg RSA -validity 3650 -keystore .keystore -ext san=dns:localhost,ip:127.0.0.1

Notice: must add -ext san=ip or dns:<DN address> in your command.

  1. Export certificate.cer file
keytool -export -alias mykey -keystore .keystore -rfc -file certificate.cer
  1. Manually import the certificate.cer into the system's trust store.
  2. Enable client SSL in IoTDB side.
  3. Configurate TLS in Client side.
var sessionPool = new SessionPool.Builder()
                .SetNodeUrls(sessionPoolTest.nodeUrls)
                .SetUsername(sessionPoolTest.username)
                .SetPassword(sessionPoolTest.password)
                .SetUseSsl(true)
                .SetCertificatePath("/path/to/certificate.cer")
                .Build();

var tableSessionPool = new TableSessionPool.Builder()
                .SetNodeUrls(sessionPoolTest.nodeUrls)
                .SetUsername(sessionPoolTest.username)
                .SetPassword(sessionPoolTest.password)
                .SetUseSsl(true)
                .SetCertificatePath("/path/to/certificate.cer")
                .Build();

Copy link
Contributor

@CritasWang CritasWang left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request adds TLS/SSL support to the Apache IoTDB C# client, allowing secure connections between clients and IoTDB servers using X.509 certificates.

Changes:

  • Added SSL configuration options (SetUseSsl and SetCertificatePath) to both SessionPool and TableSessionPool builders
  • Updated SessionPool constructors and connection logic to support SSL/TLS transport using TTlsSocketTransport
  • Cleaned up unused imports (System.Net.Sockets, System.Numerics, Microsoft.Extensions.Configuration)

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.

File Description
src/Apache.IoTDB/SessionPool.Builder.cs Added SSL configuration fields and builder methods; updated constructor calls to pass SSL parameters
src/Apache.IoTDB/TableSessionPool.Builder.cs Added SSL configuration fields and builder methods; updated SessionPool instantiation with SSL parameters
src/Apache.IoTDB/SessionPool.cs Added SSL fields, updated constructors, and modified CreateAndOpen to conditionally use TLS transport based on SSL configuration

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

Sign up for free to 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