Hello,
I’m trying to make a secure connection between the server and the client.
The host name is :qa.iot1.homecloud.honeywell.com.cn
and client has 2 ca certificate:
HoneywellQAProductPKI.pem the ca certificate
SharedQACA.pem the middle ca certificate
and device certificate is ClientCert.pem.
I don’t know how to set certifcate chain,and now i only set the root ca cetficate by:ca_file=/system/etc/security/cacerts/HoneywellQAProductPKI.pem
When i set opt.auth_mode = MBEDTLS_SSL_VERIFY_OPTIONAL,the error is :
Last error was: -0x4E00 - ECP - The signature is not valid,in tls handshake “BEDTLS_SSL_SERVER_KEY_EXCHANGE”.
when i set opt.auth_mode = MBEDTLS_SSL_VERIFY_REQUIRED,the error is:
Unable to verify the server’s certificate. Either it is invalid, or you didn’t set ca_file or ca_path to an appropriate value, in tls handshake “MBEDTLS_SSL_SERVER_CERTIFICATE”.
How to call the api to config 2 ca files?
I don’t know if the reason is the ca file error configuration.
Hi @sg0993
I have tried connecting to qa.iot1.homecloud.honeywell.com.cn and the server is sending a certificate signed by digicert.
This means you should set digicert as the trusted CA for the server.
As for setting the client certificate, you should call mbedtls_ssl_conf_own_cert() with your client certificate and your client private key.
It is safe assume that your client is signed by a CA trusted by your server (honeywell), and that your server will accept your certificate.
Please try setting the digicert certificate as the trusted root CA, and update with results.
As for setting several CA certificates, you can just concatenate all the PEM certificates into a single file.
Regsards,
Mbed Support
Ron
Hi Ron Eldor,
I have call the function mbedtls_ssl_conf_own_cert to set the client certificate and call mbedtls_ssl_conf_ca_chain to set ca certificate,and concatenate the 2 pem ca files into a single file, but also the error is the same.
the code setment: #if defined(MBEDTLS_X509_CRT_PARSE_C)
if( strcmp( opt.ca_path, “none” ) != 0 &&
strcmp( opt.ca_file, “none” ) != 0 )
{
mbedtls_ssl_conf_ca_chain( &conf, &cacert, NULL );
}
if( strcmp( opt.crt_file, “none” ) != 0 )
{
if( ( ret = mbedtls_ssl_conf_own_cert( &conf, &clicert, &pkey ) ) != 0 )
{
LOGE( " failed\n ! mbedtls_ssl_conf_own_cert returned %d\n\n", ret );
goto exit;
}
} #endif
Hi feng,
I am sorry, but as an open source project, with public support, the support channel should be done in the channel, for the benefit of the community.
Please paste a sample code here, with the logs (you can follow the example in the client application when debug_level=4)
Regards,
Ron