title: TLS error occured while trying to connect MQTT client over Secure TLS
body: <p>Actually, I wanted to implement MQTT SECURE Client over TLS using ESP8266 using Arduino IDE and wanted to check if first working on CMD line or not. But it seems it is NOT WORKING on CMD line itself.</p>
  
  <p>PLEASE LET ME KNOW IF IT IS A BUG or IF ANY CONFIGURATION MISSING. I NEED TO FIX IT AS SOON AS POSSIBLE.</p>
  
  <p>I followed <a href="https://mosquitto.org/man/mosquitto-tls-7.html" rel="nofollow noreferrer">https://mosquitto.org/man/mosquitto-tls-7.html</a> webpage
  Generate a certificate authority certificate and key.</p>
  
  <pre><code>openssl req -new -x509 -days 1095 -extensions v3_ca -keyout ca.key -out ca.crt
  </code></pre>
  
  <p>Generate a client key.</p>
  
  <pre><code>openssl genrsa -des3 -out client.key 2048
  </code></pre>
  
  <p>Generate a certificate signing request to send to the CA.</p>
  
  <pre><code>openssl req -out client.csr -key client.key -new
  </code></pre>
  
  <p>Send the CSR to the CA, or sign it with your CA key:</p>
  
  <pre><code>openssl x509 -req -in client.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out client.crt -days 1095
  </code></pre>
  
  <p>//local.conf file</p>
  
  <pre><code>bind_address 127.0.0.1
  
  port 8883
  
  tls_version tlsv1
  
  cafile C:\OpenSSL-Win64\bin\ca.crt
  
  certfile C:\OpenSSL-Win64\bin\client.crt
  
  keyfile C:\OpenSSL-Win64\bin\client.key
  
  require_certificate true
  </code></pre>
  
  <p>// One CMD window</p>
  
  <pre><code>mosquitto_sub -h 127.0.0.1 -p 8883 -q 1 -t sensor/temp --cafile C:/OpenSSL-Win64/bin/ca.crt
  </code></pre>
  
  <p>//Second CMD window</p>
  
  <pre><code>mosquitto -c local.conf -v
  </code></pre>
  
  <p>I am getting following error:</p>
  
  <p>Error: A TLS error occurred &amp;</p>
  
  <pre><code>C:\Program Files (x86)\mosquitto&gt;mosquitto -c mosquitto_m2mqtt.conf -v
  1486436916: mosquitto version 1.4.10 (build date 24/08/2016 21:03:24.73) starting
  
  1486436916: Config loaded from mosquitto_m2mqtt.conf.
  
  1486436916: Opening ipv6 listen socket on port 8883.
  
  1486436916: Opening ipv4 listen socket on port 8883.
  
  Enter PEM pass phrase:
  
  1486436943: New connection from 127.0.0.1 on port 8883.
  
  1486436943: OpenSSL Error: error:1409442E:SSL routines:ssl3_read_bytes:tlsv1 alert protocol version
  
  1486436943: OpenSSL Error: error:140940E5:SSL routines:ssl3_read_bytes:ssl handshake failure
  
  1486436943: Socket error on client &lt;unknown&gt;, disconnecting.
  </code></pre>