title: C# m2mqtt to connect to AWS broker using Root CA, key, and certificate
body: <p>I am trying to use <a href="https://github.com/eclipse/paho.mqtt.m2mqtt" rel="nofollow noreferrer">M2MQtt</a> library to connect to AWS MQTT broker using a root CA, client certificate and key. I am using the following C# client connection code</p>
  
  <pre><code>MqttClient client = new MqttClient(
      endPoint, 
      MqttSettings.MQTT_BROKER_DEFAULT_SSL_PORT,
      true,
      new X509Certificate2(@"ca.pem"),
      new X509Certificate2(@"certificate.pem"),
      MqttSslProtocols.TLSv1_2 
      );
  client.Connect(Guid.NewGuid().ToString());
  </code></pre>
  
  <p>however, this fails with a FormatException error. It's probably related to the fact that I don't know where to pass in the private key for this connection. This is something that I already have working, prototyped in Python using AWSIoTPythonSDK (see below)</p>
  
  <pre><code>from AWSIoTPythonSDK.MQTTLib import AWSIoTMQTTClient
  
  f = open('mqttEndpoint.txt', 'r')
  awsHost = f.read()
  f.close()
  
  myAWSIoTMQTTClient = AWSIoTMQTTClient('foo')
  myAWSIoTMQTTClient.configureEndpoint(awsHost, 8883)
  myAWSIoTMQTTClient.configureCredentials('ca.pem', 'id_rsa', 'certificate.pem')
  </code></pre>
  
  <p>Does anyone know how this is supposed to work?</p>