Backport ns_set_ssl_ca_cert() refactoring