Added Wi-Sun certificate options to mesh api configuration json

Added possibility to configure Wi-Sun root certificate, own certificate
and own certificate keys to mesh api.
pull/10598/head
Mika Leppänen 2019-02-28 13:33:41 +02:00
parent 8e44a75a75
commit 5fbbfee201
2 changed files with 31 additions and 0 deletions

View File

@ -153,6 +153,22 @@
"wisun-uc-dwell-interval": {
"help": "Unicast dwell interval. Range: 15-255 milliseconds",
"value": 0
},
"certificate-header": {
"help": "Certificate header",
"value": null
},
"root-certificate": {
"help": "Root certificate in PEM format (must be a null terminated c-string)",
"value": null
},
"own-certificate": {
"help": "Own certificate in PEM format (must be a null terminated c-string)",
"value": null
},
"own-certificate-key": {
"help": "Own certificate's key in PEM format (must be a null terminated c-string)",
"value": null
}
},
"target_overrides": {

View File

@ -28,6 +28,9 @@
#include "mac_api.h"
#include "sw_mac.h"
#include "ws_management_api.h" //ws_management_node_init
#ifdef MBED_CONF_MBED_MESH_API_CERTIFICATE_HEADER
#include MBED_CONF_MBED_MESH_API_CERTIFICATE_HEADER
#endif
// For tracing we need to define flag, have include and define group
//#define HAVE_DEBUG
@ -210,6 +213,18 @@ static void wisun_tasklet_configure_and_connect_to_network(void)
network_name,
fhss_timer_ptr);
#if defined(MBED_CONF_MBED_MESH_API_CERTIFICATE_HEADER)
arm_certificate_chain_entry_s chain_info;
memset(&chain_info, 0, sizeof(arm_certificate_chain_entry_s));
chain_info.cert_chain[0] = (const uint8_t *) MBED_CONF_MBED_MESH_API_ROOT_CERTIFICATE;
chain_info.cert_len[0] = strlen((const char *) MBED_CONF_MBED_MESH_API_ROOT_CERTIFICATE) + 1;
chain_info.cert_chain[1] = (const uint8_t *) MBED_CONF_MBED_MESH_API_OWN_CERTIFICATE;
chain_info.cert_len[1] = strlen((const char *) MBED_CONF_MBED_MESH_API_OWN_CERTIFICATE) + 1;
chain_info.key_chain[1] = (const uint8_t *) MBED_CONF_MBED_MESH_API_OWN_CERTIFICATE_KEY;
chain_info.chain_length = 2;
arm_network_certificate_chain_set((const arm_certificate_chain_entry_s *) &chain_info);
#endif
status = arm_nwk_interface_up(wisun_tasklet_data_ptr->network_interface_id);
if (status >= 0) {
wisun_tasklet_data_ptr->tasklet_state = TASKLET_STATE_BOOTSTRAP_STARTED;