Update IXSocketMbedTLS.cpp (#139)

fix bug with mbedtls server certificate loading.
This commit is contained in:
James Tyra 2019-12-30 18:11:34 -06:00 committed by Benjamin Sergeant
parent b5481262fb
commit 9e457871b4

View File

@ -82,6 +82,11 @@ namespace ix
errMsg = "Cannot parse key file '" + _tlsOptions.keyFile + "'";
return false;
}
if (mbedtls_ssl_conf_own_cert(&_conf, &_cert, &_pkey) < 0)
{
errMsg = "Problem configuring cert '" + _tlsOptions.certFile + "'";
return false;
}
}
if (_tlsOptions.isPeerVerifyDisabled())
@ -105,11 +110,6 @@ namespace ix
}
mbedtls_ssl_conf_ca_chain(&_conf, &_cacert, NULL);
if (_tlsOptions.hasCertAndKey())
{
mbedtls_ssl_conf_own_cert(&_conf, &_cert, &_pkey);
}
}
if (mbedtls_ssl_setup(&_ssl, &_conf) != 0)