title: MQTTnet client certification
body: <p>I have the following bug, when trying to connect to a mosquitto broker on a server using the following options, i get the following error about the Private Key, but i am using the server,crt to authenticate which has no private key assigned.</p>
  
  <p><strong>Code:</strong></p>
  
  <pre><code>    var serverCertificate = new X509Certificate2("ca.crt");
      Debug.WriteLine("+++++" + serverCertificate.HasPrivateKey);
  
      var mqttClient = new MqttFactory().CreateMqttClient();
  
      // Create TCP based options using the builder.
      var options = new MqttClientOptionsBuilder()
          .WithClientId("foo")
          .WithTcpServer("192.168.1.126", 8883)
          .WithCredentials("myusername", "mypassword")
          //.WithTls(true)
          .WithTls(true, false, false, serverCertificate.Export(X509ContentType.Cert))
          .WithCleanSession()
          .WithProtocolVersion(MqttProtocolVersion.V311)
          .WithKeepAlivePeriod(TimeSpan.FromSeconds(60))
          .WithCommunicationTimeout(TimeSpan.FromSeconds(30))
          .Build();
  
      ServicePointManager.ServerCertificateValidationCallback = delegate { return true; };
      var connect = await mqttClient.ConnectAsync(options);
  </code></pre>
  
  <p><strong>Error</strong></p>
  
  <p><img src="https://user-images.githubusercontent.com/13571540/43145133-53bb10fa-8f67-11e8-99e1-548474a5e5b9.png" alt="image"></p>
  
  <p>Any help will be appreciated, thanks!</p>