yun rev2 MQTT TLS

Hello
I'm trying to connect with a mosquito server broker with MQTT and TLS, the mosquitto broker is running in my windows pc.

I try the library GitHub - 256dpi/arduino-mqtt: MQTT library for Arduino that use the library BridgeSSLClient.h

i have configured the mosquitto server with the port 8883 and with a selfsigned certificated, i test the connection with mosquitto_pub.exe and mosquito_sub.exe and it works ok.

i have defined the next sketch, but it can not connect

#include <Bridge.h>
#include <BridgeSSLClient.h>
#include <MQTT.h>
#include <Process.h>
const char broker[] = "192.168.1.130";
const int port = 883;
const char usuario[] = "";
const char password[] ="";
int LDRPin = A0;
BridgeSSLClient clienteSSL;
MQTTClient clienteMQTT;
int V;
String mensaje;
char* val1;
char val2[] = "OTRO VALOR";
void conectaBroker(){

  • Serial.println("Conectando...");*
  • while(!clienteMQTT.connect("SoyYoDCD")){*
  • Serial.print(".");*
  • delay(1000);*
  • }*
  • Serial.println("Conectado !!!");*

}
void setup()
{

  • Bridge.begin();*
  • Serial.begin(9600);*
  • clienteMQTT.begin(broker, port, clienteSSL);*
  • conectaBroker();*
    //show my ip
  • Process p;*
  • p.runShellCommand("/sbin/ifconfig eth1 | grep 'inet addr:' | cut -d: -f2 | awk '{print $1}'");*
  • Serial.println("IP eth1: ");*
  • while (p.available()){*
  • char c = p.read();*
  • Serial.print(c);*
  • }*
  • Serial.flush();*
    }
    void loop()
    {
  • clienteMQTT.loop(); //envía los paquetes*
  • if(!clienteMQTT.connected()){*
  • conectaBroker();*
  • }*
  • V = analogRead(LDRPin);*
    *// mensaje = V; *
  • Serial.println(V);*
  • itoa(V,val1 ,10); //convertir int to string*
  • Serial.println(val1);*
  • mensaje.concat(val1);*
  • mensaje.concat(val2);*
  • Serial.println(mensaje);*
  • clienteMQTT.publish("/DcdMqtt",mensaje);*
  • delay(1000);*
    }

in the mosquitto broker console i can see the next messages when arduino yun try to connect with the bróker:

C:\DCD\PROYECTOS\BIGDATA\Via\mos158>mosquitto.exe -c mosquitto_ssl.conf -v
1561735725: mosquitto version 1.5.8 starting
1561735725: Config loaded from mosquitto_ssl.conf.
1561735725: Opening ipv6 listen socket on port 8883.
1561735725: Opening ipv4 listen socket on port 8883.
1561735924: New connection from 192.168.1.134 on port 8883.
1561735924: OpenSSL Error: error:14094418:SSL routines:ssl3_read_bytes:tlsv1 alert unknown ca
1561735924: Socket error on client , disconnecting.

it seem that arduino don’t kbnow the ca.crt certificate , when i test the MQTT connection with using mostito_pub, i pass the ca.crt certificate as a parameter in the call , as
mosquitto_pub.exe -p 8883 -m "message test" -t test --cafile ca.crt –insecure
But in yun i don’t know how can send the ca.crt certificate in the publish call. I don’t if i need to load the ca.crt certificate to opwnwrt Linux of yun, and how to do this..

Anybody could help me?, is there other library to connect from yun with a tls mqtt bróker.

Thanks in advance for your help
Best regards
diego

i solved this problem installing the ca certificate following the instructions of Allowing SSL in wget on OpenWrt/LEDE - oct8l's pages

now don¡t receive te error of the unknow ca but don't connect

now when try to make the connect passing user and password we receive the error -6 LWMQTT_NETWORK_FAILED_WRITE.

and don't connect.
any idieas?
regards
diego