Skip to content

Commit

Permalink
bugfix/mqtt examples: Updates the CA certificates used.
Browse files Browse the repository at this point in the history
- Updates the CA certificates.
- Updates the URI names to reflect the new URI in the service used in
  the examples.

Closes IDFGH-4986
Closes #6776
  • Loading branch information
euripedesrocha authored and david-cermak committed May 13, 2021
1 parent 410a0a5 commit d5e2a48
Show file tree
Hide file tree
Showing 10 changed files with 72 additions and 66 deletions.
2 changes: 1 addition & 1 deletion examples/protocols/mqtt/ssl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_exam
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(mqtt_ssl)

target_add_binary_data(mqtt_ssl.elf "main/mqtt_eclipse_org.pem" TEXT)
target_add_binary_data(mqtt_ssl.elf "main/mqtt_eclipseprojects_io.pem" TEXT)
8 changes: 4 additions & 4 deletions examples/protocols/mqtt/ssl/main/app_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ static const char *TAG = "MQTTS_EXAMPLE";


#if CONFIG_BROKER_CERTIFICATE_OVERRIDDEN == 1
static const uint8_t mqtt_eclipse_org_pem_start[] = "-----BEGIN CERTIFICATE-----\n" CONFIG_BROKER_CERTIFICATE_OVERRIDE "\n-----END CERTIFICATE-----";
static const uint8_t mqtt_eclipseprojects_io_pem_start[] = "-----BEGIN CERTIFICATE-----\n" CONFIG_BROKER_CERTIFICATE_OVERRIDE "\n-----END CERTIFICATE-----";
#else
extern const uint8_t mqtt_eclipse_org_pem_start[] asm("_binary_mqtt_eclipse_org_pem_start");
extern const uint8_t mqtt_eclipseprojects_io_pem_start[] asm("_binary_mqtt_eclipseprojects_io_pem_start");
#endif
extern const uint8_t mqtt_eclipse_org_pem_end[] asm("_binary_mqtt_eclipse_org_pem_end");
extern const uint8_t mqtt_eclipseprojects_io_pem_end[] asm("_binary_mqtt_eclipseprojects_io_pem_end");

//
// Note: this function is for testing purposes only publishing part of the active partition
Expand Down Expand Up @@ -119,7 +119,7 @@ static void mqtt_app_start(void)
{
const esp_mqtt_client_config_t mqtt_cfg = {
.uri = CONFIG_BROKER_URI,
.cert_pem = (const char *)mqtt_eclipse_org_pem_start,
.cert_pem = (const char *)mqtt_eclipseprojects_io_pem_start,
};

ESP_LOGI(TAG, "[APP] Free memory: %d bytes", esp_get_free_heap_size());
Expand Down
2 changes: 1 addition & 1 deletion examples/protocols/mqtt/ssl/main/component.mk
Original file line number Diff line number Diff line change
@@ -1 +1 @@
COMPONENT_EMBED_TXTFILES := mqtt_eclipse_org.pem
COMPONENT_EMBED_TXTFILES := mqtt_eclipseprojects_io.pem
27 changes: 0 additions & 27 deletions examples/protocols/mqtt/ssl/main/mqtt_eclipse_org.pem

This file was deleted.

30 changes: 30 additions & 0 deletions examples/protocols/mqtt/ssl/main/mqtt_eclipseprojects_io.pem
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
-----BEGIN CERTIFICATE-----
MIIFFjCCAv6gAwIBAgIRAJErCErPDBinU/bWLiWnX1owDQYJKoZIhvcNAQELBQAw
TzELMAkGA1UEBhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2Vh
cmNoIEdyb3VwMRUwEwYDVQQDEwxJU1JHIFJvb3QgWDEwHhcNMjAwOTA0MDAwMDAw
WhcNMjUwOTE1MTYwMDAwWjAyMQswCQYDVQQGEwJVUzEWMBQGA1UEChMNTGV0J3Mg
RW5jcnlwdDELMAkGA1UEAxMCUjMwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK
AoIBAQC7AhUozPaglNMPEuyNVZLD+ILxmaZ6QoinXSaqtSu5xUyxr45r+XXIo9cP
R5QUVTVXjJ6oojkZ9YI8QqlObvU7wy7bjcCwXPNZOOftz2nwWgsbvsCUJCWH+jdx
sxPnHKzhm+/b5DtFUkWWqcFTzjTIUu61ru2P3mBw4qVUq7ZtDpelQDRrK9O8Zutm
NHz6a4uP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V2z0gp35Z0+L4WPlbuEjN/lxPFin+
HlUjr8gRsI3qfJOQFy/9rKIJR0Y/8Omwt/8oTWgy1mdeHmmjk7j1nYsvC9JSQ6Zv
MldlTTKB3zhThV1+XWYp6rjd5JW1zbVWEkLNxE7GJThEUG3szgBVGP7pSWTUTsqX
nLRbwHOoq7hHwg==
-----END CERTIFICATE-----
2 changes: 1 addition & 1 deletion examples/protocols/mqtt/wss/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ set(EXTRA_COMPONENT_DIRS $ENV{IDF_PATH}/examples/common_components/protocol_exam
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(mqtt_websocket_secure)

target_add_binary_data(mqtt_websocket_secure.elf "main/mqtt_eclipse_org.pem" TEXT)
target_add_binary_data(mqtt_websocket_secure.elf "main/mqtt_eclipseprojects_io.pem" TEXT)
8 changes: 4 additions & 4 deletions examples/protocols/mqtt/wss/main/app_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ static const char *TAG = "MQTTWSS_EXAMPLE";


#if CONFIG_BROKER_CERTIFICATE_OVERRIDDEN == 1
static const uint8_t mqtt_eclipse_org_pem_start[] = "-----BEGIN CERTIFICATE-----\n" CONFIG_BROKER_CERTIFICATE_OVERRIDE "\n-----END CERTIFICATE-----";
static const uint8_t mqtt_eclipseprojects_io_pem_start[] = "-----BEGIN CERTIFICATE-----\n" CONFIG_BROKER_CERTIFICATE_OVERRIDE "\n-----END CERTIFICATE-----";
#else
extern const uint8_t mqtt_eclipse_org_pem_start[] asm("_binary_mqtt_eclipse_org_pem_start");
extern const uint8_t mqtt_eclipseprojects_io_pem_start[] asm("_binary_mqtt_eclipseprojects_io_pem_start");
#endif
extern const uint8_t mqtt_eclipse_org_pem_end[] asm("_binary_mqtt_eclipse_org_pem_end");
extern const uint8_t mqtt_eclipseprojects_io_pem_end[] asm("_binary_mqtt_eclipseprojects_io_pem_end");

static esp_err_t mqtt_event_handler_cb(esp_mqtt_event_handle_t event)
{
Expand Down Expand Up @@ -95,7 +95,7 @@ static void mqtt_app_start(void)
{
const esp_mqtt_client_config_t mqtt_cfg = {
.uri = CONFIG_BROKER_URI,
.cert_pem = (const char *)mqtt_eclipse_org_pem_start,
.cert_pem = (const char *)mqtt_eclipseprojects_io_pem_start,
};

ESP_LOGI(TAG, "[APP] Free memory: %d bytes", esp_get_free_heap_size());
Expand Down
2 changes: 1 addition & 1 deletion examples/protocols/mqtt/wss/main/component.mk
Original file line number Diff line number Diff line change
@@ -1 +1 @@
COMPONENT_EMBED_TXTFILES := mqtt_eclipse_org.pem
COMPONENT_EMBED_TXTFILES := mqtt_eclipseprojects_io.pem
27 changes: 0 additions & 27 deletions examples/protocols/mqtt/wss/main/mqtt_eclipse_org.pem

This file was deleted.

30 changes: 30 additions & 0 deletions examples/protocols/mqtt/wss/main/mqtt_eclipseprojects_io.pem
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
-----BEGIN CERTIFICATE-----
MIIFFjCCAv6gAwIBAgIRAJErCErPDBinU/bWLiWnX1owDQYJKoZIhvcNAQELBQAw
TzELMAkGA1UEBhMCVVMxKTAnBgNVBAoTIEludGVybmV0IFNlY3VyaXR5IFJlc2Vh
cmNoIEdyb3VwMRUwEwYDVQQDEwxJU1JHIFJvb3QgWDEwHhcNMjAwOTA0MDAwMDAw
WhcNMjUwOTE1MTYwMDAwWjAyMQswCQYDVQQGEwJVUzEWMBQGA1UEChMNTGV0J3Mg
RW5jcnlwdDELMAkGA1UEAxMCUjMwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK
AoIBAQC7AhUozPaglNMPEuyNVZLD+ILxmaZ6QoinXSaqtSu5xUyxr45r+XXIo9cP
R5QUVTVXjJ6oojkZ9YI8QqlObvU7wy7bjcCwXPNZOOftz2nwWgsbvsCUJCWH+jdx
sxPnHKzhm+/b5DtFUkWWqcFTzjTIUu61ru2P3mBw4qVUq7ZtDpelQDRrK9O8Zutm
NHz6a4u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