salmanzafar949/MQTT-Laravel

Connecting using client certificates

Closed this issue · 1 comments

Can you add in a config option to allow for client certificate and private key as per http://www.steves-internet-guide.com/creating-and-using-client-certificates-with-mqtt-and-mosquitto/

The solution is to pass the two files, along with the CA cert, to the stream_context_create() function in file /src/MqttService.php line 69, e.g.

$socketContext = stream_context_create(["ssl" => [
    "verify_peer_name" => true,
    "cafile" => $this->cafile,
    "local_cert" => $this->localcert,
    "local_pk" => $this->localpk
]]);

Will work on it as soon as i get time.

or you can make pr for this if you have time.