print cert, return on error after free'ing
This commit is contained in:
@@ -115,8 +115,6 @@ int WiFiSSLClient::connect(const char* host, uint16_t port)
|
|||||||
|
|
||||||
int WiFiSSLClient::connect(const char* host, uint16_t port, const char* client_cert, const char* client_key)
|
int WiFiSSLClient::connect(const char* host, uint16_t port, const char* client_cert, const char* client_key)
|
||||||
{
|
{
|
||||||
//char* client_cert = NULL;
|
|
||||||
//char* client_key = NULL;
|
|
||||||
int ret, flags;
|
int ret, flags;
|
||||||
synchronized {
|
synchronized {
|
||||||
_netContext.fd = -1;
|
_netContext.fd = -1;
|
||||||
@@ -204,7 +202,9 @@ int WiFiSSLClient::connect(const char* host, uint16_t port, const char* client_c
|
|||||||
ret = mbedtls_x509_crt_parse(&_clientCrt, (const unsigned char *)client_cert, strlen(client_cert) + 1);
|
ret = mbedtls_x509_crt_parse(&_clientCrt, (const unsigned char *)client_cert, strlen(client_cert) + 1);
|
||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
ets_printf("Client cert not parsed, %d\n", ret);
|
ets_printf("Client cert not parsed, %d\n", ret);
|
||||||
|
ets_printf("\nCert: \n %s", &_clientCrt);
|
||||||
stop();
|
stop();
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ets_printf("Loading private key.\n");
|
ets_printf("Loading private key.\n");
|
||||||
@@ -213,6 +213,7 @@ int WiFiSSLClient::connect(const char* host, uint16_t port, const char* client_c
|
|||||||
if (ret != 0) {
|
if (ret != 0) {
|
||||||
ets_printf("Private key not parsed properly: %d\n", ret);
|
ets_printf("Private key not parsed properly: %d\n", ret);
|
||||||
stop();
|
stop();
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
// set own certificate chain and key
|
// set own certificate chain and key
|
||||||
ret = mbedtls_ssl_conf_own_cert(&_sslConfig, &_clientCrt, &_clientKey);
|
ret = mbedtls_ssl_conf_own_cert(&_sslConfig, &_clientCrt, &_clientKey);
|
||||||
@@ -222,6 +223,7 @@ int WiFiSSLClient::connect(const char* host, uint16_t port, const char* client_c
|
|||||||
}
|
}
|
||||||
ets_printf("Private key not parsed properly: %d\n", ret);
|
ets_printf("Private key not parsed properly: %d\n", ret);
|
||||||
stop();
|
stop();
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
Reference in New Issue
Block a user