esp32-aws-iot
esp32-aws-iot copied to clipboard
how to generate certs
Hi I am learning to use AWS IoT on ESP32 with IDF. Currently I generated certain certs and keys following some steps on AWS IoT console. but there are not files with .pem.crt extension like
certificate.pem.crt
private.pem.key
only files I have is
myCAprivatekey.key
myiotCAcert.pem
myiotCAcert.srl
verificationCert.crt
verificationCert.csr
verificationCert.key
how to generated .pem.crt file???
I ran following command
openssl x509 -req -in verificationCert.csr -CA myiotCAcert.pem -CAkey myCAprivatekey.key -CAcreateserial -out verificationCert.crt -days 500 -sha256
ok so I followed this http://docs.aws.amazon.com/iot/latest/developerguide/device-certs-your-own.html
and Registering Your CA Certificate Creating a Device Certificate Using Your CA Certificate
now I have following files
deviceCert.csr
deviceCert.key
deviceCert.pem
rootCA.key
rootCA.pem
rootCA.srl
verificationCert.crt
verificationCert.csr
verificationCert.key
and I put deviceCert.key & deviceCert.pem in certs folder
and make gives me
/esp/esp32-aws-iot-master/components/awsiot/src/aws_iot_mqtt_client_connect.c: In function 'aws_iot_mqtt_connect':
/esp/esp32-aws-iot-master/components/awsiot/src/aws_iot_mqtt_client_connect.c:452:18: warning: variable 'disconRc' set but not used [-Wunused-but-set-variable]
IoT_Error_t rc, disconRc;
^
CC src/aws_iot_mqtt_client_publish.o
CC src/aws_iot_mqtt_client_subscribe.o
CC src/aws_iot_mqtt_client_unsubscribe.o
CC src/aws_iot_mqtt_client_yield.o
CC src/aws_iot_shadow.o
/esp/esp32-aws-iot-master/components/awsiot/src/aws_iot_shadow.c:39:19: warning: missing initializer for field 'deleteActionHandler' of 'ShadowConnectParameters_t {aka const struct <anonymous>}' [-Wmissing-field-initializers]
(char *) AWS_IOT_MQTT_CLIENT_ID, 0};
^
In file included from /esp/esp32-aws-iot-master/components/awsiot/src/aws_iot_shadow.c:27:0:
/esp/esp32-aws-iot-master/components/awsiot/include/aws_iot_shadow_interface.h:75:24: note: 'deleteActionHandler' declared here
pApplicationHandler_t deleteActionHandler; ///< Callback to be invoked when Thing shadow for this device is deleted
^
CC src/aws_iot_shadow_actions.o
CC src/aws_iot_shadow_json.o
/esp/esp32-aws-iot-master/components/awsiot/src/aws_iot_shadow_json.c: In function 'isJsonValidAndParse':
/esp/esp32-aws-iot-master/components/awsiot/src/aws_iot_shadow_json.c:327:59: error: parameter 'pJsonHandler' set but not used [-Werror=unused-but-set-parameter]
bool isJsonValidAndParse(const char *pJsonDocument, void *pJsonHandler, int32_t *pTokenCount) {
^
/esp/esp32-aws-iot-master/components/awsiot/src/aws_iot_shadow_json.c: In function 'isJsonKeyMatchingAndUpdateValue':
/esp/esp32-aws-iot-master/components/awsiot/src/aws_iot_shadow_json.c:381:13: warning: variable 'pJsonTokenStruct' set but not used [-Wunused-but-set-variable]
jsmntok_t *pJsonTokenStruct;
^
cc1: some warnings being treated as errors
make[1]: *** [src/aws_iot_shadow_json.o] Error 1
make: *** [awsiot-build] Error 2
Hi so I followed simple way just to test things work fine and I directly generated the certs and key and root-CA.crt from AWS.. now MY device works compiles and but one issue.
I (2622) wifi: connected with UNICORN, channel 1
Connected to AP
I (12609) wifi: pm start, type:0
abort() was called at PC 0x400df1ef on core 0
0x400df1ef: record_temp_task at /esp/esp32-aws-iot-master/main/./main.c:136
Backtrace: 0x4008622c:0x3ffc6020 0x4008632b:0x3ffc6040 0x400df1ef:0x3ffc6060
0x4008622c: invoke_abort at/esp/esp-idf/components/esp32/./panic.c:519
0x4008632b: abort at /esp/esp-idf/components/esp32/./panic.c:519
0x400df1ef: record_temp_task at /esp/esp32-aws-iot-master/main/./main.c:136
it aborts Let me try with the given example in IDF and see if its with the certs I donwloaded or with some thing else.
https://github.com/espressif/esp-idf/issues/1350