aws iot


guy.benyehuda@...
 

looking for an example/insights with respect to working with aws iot and/or using x.509 certificate.
any information will be much appreciated.
thanks, guy


Ryan Erickson
 

Hey Guy,

Start with the MQTT publisher example. You only need to make a few small tweaks to account for the device cert and key.
For example:

#if defined(CONFIG_MQTT_LIB_TLS)
 
#include "certificate.h"
 
#define APP_CA_CERT_TAG CA_TAG
#define APP_DEVICE_CERT_TAG DEVICE_CERT_TAG
 
static sec_tag_t m_sec_tags[] = {
#if defined(CONFIG_NET_SOCKETS_SOCKOPT_TLS)
APP_CA_CERT_TAG, APP_DEVICE_CERT_TAG
#endif
};
 
static int tls_init(void)
{
int err = -EINVAL;
 
#if defined(CONFIG_NET_SOCKETS_SOCKOPT_TLS)
err = tls_credential_add(APP_CA_CERT_TAG, TLS_CREDENTIAL_CA_CERTIFICATE,
ca_certificate, sizeof(ca_certificate));
if (err < 0) {
LOG_ERR("Failed to register public certificate: %d", err);
return err;
}
 
err = tls_credential_add(APP_DEVICE_CERT_TAG,
TLS_CREDENTIAL_SERVER_CERTIFICATE,
dev_certificate, sizeof(dev_certificate));
if (err < 0) {
LOG_ERR("Failed to register device certificate: %d", err);
return err;
}
 
err = tls_credential_add(APP_DEVICE_CERT_TAG,
TLS_CREDENTIAL_PRIVATE_KEY, dev_key,
sizeof(dev_key));
if (err < 0) {
LOG_ERR("Failed to register device key: %d", err);
return err;
}
#endif
 
return err;
}
 
#endif /* CONFIG_MQTT_LIB_TLS */


Adam Podogrocki
 

Hi Guy,

please take a look at
https://mender.io/blog/mender-and-microsoft-azure-iot-facilitate-robust-and-secure-device-software-management-update

It refers to BeagleBone Black board and Azure IoT, but I guess the principle is the same.

Regards,
Adam

On Mon, 24 Jun 2019 at 15:03, <guy.benyehuda@...> wrote:
looking for an example/insights with respect to working with aws iot and/or using x.509 certificate.
any information will be much appreciated.
thanks, guy


Wang, Steven L
 

Hi guy:

    Basically, I think you need to port AWS IOT SDK to zephyr. 

   https://docs.aws.amazon.com/iot/latest/developerguide/iot-sdks.html


-Steven

On 6/24/2019 8:46 PM, guy.benyehuda@... wrote:

looking for an example/insights with respect to working with aws iot and/or using x.509 certificate.
any information will be much appreciated.
thanks, guy


Ryan Erickson
 

There is no need to port the AWS IOT SDK to Zephyr.  Zephyr has all the pieces you need.  I am successfully connecting to AWS with the MQTT publisher example along with the few modifications I mentioned previously.