Send client and root CA certificate
- Dominant language
- C#
- Stars
- 5.1k
- Forks
- 1.2k
- PR merge metrics
- No merged PRs in 30d
Description
### Describe your question
I have a pkcs12 file that contains the client certificate, CA, and private key.
Moquette Server (specific application requirements) expects that client using Certificates must send the full certificate chain, including the uploaded CA certificate.
Using the code below, the server only receives the client's certificate. Is it possible using MQTTnet to send also CA_Certificate?
``` static void Main(string[] args) {
var cSource = new CancellationTokenSource();
var cToken = cSource.Token;
Console.CancelKeyPress += (sender, eventArgs) =>cSource.Cancel();
try {
var caCert = new X509Certificate("caCert.crt");
var clientCert = new X509Certificate2( @ "certificate.pfx", "somePassword");
var options = new MqttClientOptionsBuilder()
.WithClientId(clientId)
.WithTcpServer(serverUrl, serverPort)
.WithKeepAlivePeriod(new TimeSpan(0, 0, 0, 300))
.WithCleanSession(true)
.WithTls(new MqttClientOptionsBuilderTlsParameters() {
UseTls =true,
AllowUntrustedCertificates =true,
IgnoreCertificateChainErrors =true,
IgnoreCertificateRevocationErrors =true,
SslProtocol =System.Security.Authentication.SslProtocols.Tls12,
Certificates =new List
{
clientCert, caCert
},
})
.Build();
var factory = new MqttFactory();
var client = factory.CreateMqttClient();
client.ConnectAsync(options, cToken).Wait(cToken);
}
}```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.