4

I have configured the mosquitto mqtt broker on a raspberry pi via this link

I have the ca.crt,client.crt and client.key. How do I use them in android? It would be really nice if someone could help me out here

  • 1
    This is really a specific programming question more than a generic IoT question. I would suggest you ask this sort of thing on Stack Overflow (and please do not cross post questions between the 2) – hardillb May 18 '18 at 12:06
  • There are manyMQTT clients for Android out on the Google Play Store....you just need to find one that will let you install the certs and use them :) – JD Allen May 18 '18 at 13:38
  • Rather than using self-signed certificates for which you need to tell your client to trust them: use something that your Android client might trust out of the box. Using Let's Encrypt gives you free certificates that are trusted by modern software. (But note that if a browser on your Android device trusts this, it might still not be trusted by Android itself, or some MQTT client running on that device.) See, for example, pimylifeup.com/raspberry-pi-ssl-lets-encrypt – Arjan May 18 '18 at 17:39
  • It'll depend on the app, but with Owntracks you set the certificates in the security section of the connection preferences – Aaron F May 23 '18 at 19:06
2

I have found the answer to this and it can be achieved by creating a .pem file which includes the client.crt and client.key.

Then we can create a .bks using portecle which should contain client.pem, ca.crt and server.crt and then we create a socketfactory with the bks and add that socketfactory to client.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.