title: Mosquitto Connection Errors
body: <p>I have a Mosquitto 2.0.14 broker running in a Windows server 2019. I have following configs in <code>mosquitto.conf</code>:</p>
  <pre><code>listener 1883 localhost
  allow_anonymous true
  
  listener 8883
  protocol mqtt
  allow_anonymous false
  password_file C:\mosquitto\password.txt
  certfile C:\Certbot\live\dev-mqtt-broker.mysite.com\cert.pem
  cafile C:\Certbot\live\dev-mqtt-broker.mysite.com\fullchain.pem
  keyfile C:\Certbot\live\dev-mqtt-broker.mysite.com\privkey.pem
  
  listener 9002
  protocol websockets
  socket_domain ipv4
  allow_anonymous false
  password_file C:\mosquitto\password.txt
  </code></pre>
  <p>I can connect to it over all these ports using <code>mqtt://</code>, <code>mqtts://</code>, <code>ssl://</code> and <code>ws://</code>,  protocols from NodeJS Code using MQTT.js library and from third party MQTT Clients like MQTTX.</p>
  <p>But when I try to connect my device using <code>ssl://</code> protocol over port <code>8883</code>, sometimes I get different kinds of errors in Mosquitto logs. Some of these errors are:</p>
  <pre><code>OpenSSL Error[0]: error:14094415:SSL routines:ssl3_read_bytes:sslv3 alert certificate expired
  
  OpenSSL Error[0]: error:141CF06C:SSL routines:tls_parse_ctos_key_share:bad key share
  
  OpenSSL Error[0]: error:1408F10B:SSL routines:ssl3_get_record:wrong version number (frequent)
  
  OpenSSL Error[0]: error:1408F09C:SSL routines:ssl3_get_record:http request (frequent)
  
  OpenSSL Error[0]: error:142090C1:SSL routines:tls_early_post_process_client_hello:no shared cipher
  
  OpenSSL Error[0]: error:1417A0C1:SSL routines:tls_post_process_client_hello:no shared cipher
  
  Client &lt;unknown&gt; disconnected due to protocol error.
  
  Client &lt;unknown&gt; disconnected due to malformed packet.
  </code></pre>
  <p>I have spent considerable time trying to learn about these errors but I can't seem to understand what is happening.</p>
  <p>Any help would be great. Thanks in advance.</p>