I'm using MqttNet Library to connect with provided Mqtt Server in my application. I'm using managed mqttnet client from here
getting a little problem I'm unable to add certificate with client. it is giving me error of type mismatch.
this is my code.
 var URL = MqttConfiguration.MqttBrokerAddress;
        var username = MqttConfiguration.MqttClientUserName;
        var password = MqttConfiguration.MqttClientPassword;
        var SSLport = MqttConfiguration.SSLPort;
        var options = new ManagedMqttClientOptionsBuilder()
            .WithAutoReconnectDelay(TimeSpan.FromSeconds(30))
            .WithClientOptions(new MqttClientOptionsBuilder()
                .WithClientId(Guid.NewGuid().ToString())
                .WithTcpServer(URL, SSLport)
                .WithCredentials(username, password)
                //.WithTls( GetMqttClientOptions())
                .WithTls(new MqttClientOptionsBuilderTlsParameters()
                {
                    AllowUntrustedCertificates = false,
                    UseTls = true,
                    Certificates = new List<byte[]> { new X509Certificate2(caCert).Export(X509ContentType.Cert) },
                    CertificateValidationCallback = delegate { return true; },
                    IgnoreCertificateChainErrors = false,
                    IgnoreCertificateRevocationErrors = false
                })
                .WithCleanSession()
                .WithProtocolVersion(MQTTnet.Formatter.MqttProtocolVersion.V311)
                .Build())
            .Build();
        await mqttClient.SubscribeAsync(new TopicFilterBuilder().WithTopic(Topics.handshake).Build());
        await mqttClient.StartAsync(options);
I'm getting the error when on this line
Certificates = new List<byte[]> { new X509Certificate2(caCert).Export(X509ContentType.Cert) },
Error message
I've been stuck here from two days. need help.
