This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

NRF9160 Unable to disable certificate validation when connecting to https

Hi all!
Since I do not have a system for updating the certificate when changing the server, I decided to disable certificate verification when connecting to the https server. Here is the code:

Since the certificate is not needed I do not execute the cert_provision function.
Here is the server connection code:

I end up getting "connect() failed, err: 95" when I try to connect to the server.

I also noticed one feature, on the nrf9160 into which I previously downloaded the certificate, the connection is successful. However, on the new (clean) nrf9160 I get the error "connect() failed, err: 95". It seems that the certificate remains in the modem and therefore on the old nrf9160 I can connect but not on the new one.

As a result, it is not clear how to work without knowing the CA certificate. 
Thanks!