+nc_client_t *nc_client_tls_connect(const char *host, uint16_t port) {
+ assert(host);
+ assert(port > 20);
+
+ nc_client_t *client = (nc_client_t *)malloc(sizeof(nc_client_t));
+ if(client == 0) {
+ return 0;
+ }
+
+ client->edit_batch_root = 0;
+ client->password = 0;
+ int rc = nc_client_tls_set_cert_key_paths(CLIENT_CERT_PATH, CLIENT_KEY_PATH);
+ if(rc != 0) {
+ log_error("nc_client_tls_set_cert_key_paths failed\n");
+ return 0;
+ }
+
+ rc = nc_client_tls_set_trusted_ca_paths(CLIENT_CA_FILE, 0);
+ if(rc != 0) {
+ log_error("nc_client_tls_set_trusted_ca_paths failed\n");
+ return 0;
+ }
+
+ client->session = nc_connect_tls(host, port, 0);
+ if(client->session == 0) {
+ log_error("nc_connect_tls failed\n");
+ free(client);
+ return 0;
+ }
+
+ return client;
+}
+