![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
V.06 11/3
Dependencies: FT6206 SDFileSystem SPI_TFT_ILI9341 TFT_fonts
Fork of ATT_AWS_IoT_demo by
Diff: AWS_openssl/aws_iot_src/protocol/mqtt/aws_iot_embedded_client_wrapper/platform_mbed_os/mbedtls/network_mbedtls_wrapper.cpp
- Revision:
- 29:f71a0be59b99
- Parent:
- 28:54d9a550adf1
--- a/AWS_openssl/aws_iot_src/protocol/mqtt/aws_iot_embedded_client_wrapper/platform_mbed_os/mbedtls/network_mbedtls_wrapper.cpp Mon Oct 09 21:13:49 2017 +0000 +++ b/AWS_openssl/aws_iot_src/protocol/mqtt/aws_iot_embedded_client_wrapper/platform_mbed_os/mbedtls/network_mbedtls_wrapper.cpp Fri Nov 03 20:28:02 2017 +0000 @@ -52,6 +52,8 @@ FILE *fp; char fp_buffer[CERT_MAX_SIZE]; +unsigned char cSubject[100]; + // From main.cpp extern char HostAddress[255]; extern char MqttClientID[32]; @@ -292,6 +294,37 @@ ret = mbedtls_x509_crt_parse_file(&clicert, AWS_IOT_CERTIFICATE_FILENAME); #else ret = mbedtls_x509_crt_parse(&clicert, (const unsigned char *)AWS_IOT_CERTIFICATE, AWS_IOT_CERTIFICATE_LENGTH); + DEBUG ("cert version = %d", clicert.version); + + + + /* + for (int k = 0; k < clicert.subject_raw.len; k++) + { + DEBUG ("%02X", clicert.subject_raw.p[k]); + } + */ + + for (int i = 0; i < clicert.subject_raw.len; i++) + { + if (clicert.subject_raw.p[i] == 0x0C) + { + i++; + unsigned char cLength = clicert.subject_raw.p[i]; + DEBUG ("subject length = %d", cLength); + i++; + for (int j = 0; j < (int) cLength; j++) + { + cSubject[j] = clicert.subject_raw.p[i]; + i++; + } + cSubject[cLength] = 0x00; + break; + } + } + + + DEBUG ("Subject = %s", cSubject); //ret = mbedtls_x509_crt_parse(&clicert, (const unsigned char *)AWS_IOT_CERTIFICATE, 862); //ret = mbedtls_x509_crt_parse(&clicert, (const unsigned char *)AWS_IOT_CERTIFICATE, strlen ((const char *)AWS_IOT_CERTIFICATE)+1); #endif