Michal Vasko | 45f298f | 2016-01-29 10:26:26 +0100 | [diff] [blame] | 1 | /** |
| 2 | * \file session_client_ch.h |
| 3 | * \author Michal Vasko <mvasko@cesnet.cz> |
| 4 | * \brief libnetconf2 Call Home session client manipulation |
| 5 | * |
| 6 | * Copyright (c) 2015 CESNET, z.s.p.o. |
| 7 | * |
Radek Krejci | 9b81f5b | 2016-02-24 13:14:49 +0100 | [diff] [blame] | 8 | * This source code is licensed under BSD 3-Clause License (the "License"). |
| 9 | * You may not use this file except in compliance with the License. |
| 10 | * You may obtain a copy of the License at |
Michal Vasko | afd416b | 2016-02-25 14:51:46 +0100 | [diff] [blame] | 11 | * |
Radek Krejci | 9b81f5b | 2016-02-24 13:14:49 +0100 | [diff] [blame] | 12 | * https://opensource.org/licenses/BSD-3-Clause |
Michal Vasko | 45f298f | 2016-01-29 10:26:26 +0100 | [diff] [blame] | 13 | */ |
| 14 | |
| 15 | #ifndef NC_SESSION_CLIENT_CH_H_ |
| 16 | #define NC_SESSION_CLIENT_CH_H_ |
| 17 | |
Michal Vasko | c09730e | 2019-01-17 10:07:26 +0100 | [diff] [blame] | 18 | #ifdef __cplusplus |
| 19 | extern "C" { |
| 20 | #endif |
| 21 | |
Michal Vasko | 45f298f | 2016-01-29 10:26:26 +0100 | [diff] [blame] | 22 | #include <libyang/libyang.h> |
| 23 | |
Michal Vasko | 45f298f | 2016-01-29 10:26:26 +0100 | [diff] [blame] | 24 | #include "messages_client.h" |
Michal Vasko | b83a3fa | 2021-05-26 09:53:42 +0200 | [diff] [blame] | 25 | #include "netconf.h" |
| 26 | #include "session.h" |
Michal Vasko | 45f298f | 2016-01-29 10:26:26 +0100 | [diff] [blame] | 27 | |
Michal Vasko | b83a3fa | 2021-05-26 09:53:42 +0200 | [diff] [blame] | 28 | #if defined (NC_ENABLED_SSH) || defined (NC_ENABLED_TLS) |
Michal Vasko | 45f298f | 2016-01-29 10:26:26 +0100 | [diff] [blame] | 29 | |
| 30 | /** |
Radek Krejci | 6799a05 | 2017-05-19 14:23:23 +0200 | [diff] [blame] | 31 | * @defgroup client_ch Client-side Call Home |
| 32 | * @ingroup client |
| 33 | * |
| 34 | * @brief Call Home functionality for client-side applications. |
| 35 | * @{ |
| 36 | */ |
| 37 | |
| 38 | /** |
Michal Vasko | 45f298f | 2016-01-29 10:26:26 +0100 | [diff] [blame] | 39 | * @brief Accept a Call Home connection on any of the listening binds. |
| 40 | * |
| 41 | * @param[in] timeout Timeout for receiving a new connection in milliseconds, 0 for |
| 42 | * non-blocking call, -1 for infinite waiting. |
| 43 | * @param[in] ctx Session context to use. Can be NULL. |
| 44 | * @param[out] session New session. |
Michal Vasko | f0537d8 | 2016-01-29 14:42:38 +0100 | [diff] [blame] | 45 | * @return 1 on success, 0 on timeout, -1 on error. |
Michal Vasko | 45f298f | 2016-01-29 10:26:26 +0100 | [diff] [blame] | 46 | */ |
| 47 | int nc_accept_callhome(int timeout, struct ly_ctx *ctx, struct nc_session **session); |
| 48 | |
Radek Krejci | 6799a05 | 2017-05-19 14:23:23 +0200 | [diff] [blame] | 49 | /**@} Client-side Call Home */ |
| 50 | |
Radek Krejci | 53691be | 2016-02-22 13:58:37 +0100 | [diff] [blame] | 51 | #endif /* NC_ENABLED_SSH || NC_ENABLED_TLS */ |
Michal Vasko | 45f298f | 2016-01-29 10:26:26 +0100 | [diff] [blame] | 52 | |
Radek Krejci | 53691be | 2016-02-22 13:58:37 +0100 | [diff] [blame] | 53 | #ifdef NC_ENABLED_SSH |
Michal Vasko | 45f298f | 2016-01-29 10:26:26 +0100 | [diff] [blame] | 54 | |
| 55 | /** |
Radek Krejci | 6799a05 | 2017-05-19 14:23:23 +0200 | [diff] [blame] | 56 | * @defgroup client_ch_ssh Client-side Call Home on SSH |
| 57 | * @ingroup client_ch |
| 58 | * |
| 59 | * @brief SSH settings for the Call Home functionality |
| 60 | * @{ |
| 61 | */ |
| 62 | |
| 63 | /** |
Radek Krejci | 90a84a2 | 2017-05-25 13:53:00 +0200 | [diff] [blame] | 64 | * @brief Set SSH Call Home authentication hostkey check (knownhosts) callback. |
| 65 | * |
| 66 | * Repetitive calling causes replacing of the previous callback and its private data. Caller is responsible for |
| 67 | * freeing the private data when necessary (the private data can be obtained by |
| 68 | * nc_client_ssh_ch_get_auth_hostkey_check_clb()). |
Michal Vasko | ef112d7 | 2016-02-18 13:28:25 +0100 | [diff] [blame] | 69 | * |
| 70 | * @param[in] auth_hostkey_check Function to call, returns 0 on success, non-zero in error. |
| 71 | * If NULL, the default callback is set. |
Radek Krejci | 90a84a2 | 2017-05-25 13:53:00 +0200 | [diff] [blame] | 72 | * @param[in] priv Optional private data to be passed to the callback function. |
Michal Vasko | ef112d7 | 2016-02-18 13:28:25 +0100 | [diff] [blame] | 73 | */ |
Radek Krejci | 90a84a2 | 2017-05-25 13:53:00 +0200 | [diff] [blame] | 74 | void nc_client_ssh_ch_set_auth_hostkey_check_clb(int (*auth_hostkey_check)(const char *hostname, ssh_session session, void *priv), |
Michal Vasko | b83a3fa | 2021-05-26 09:53:42 +0200 | [diff] [blame] | 75 | void *priv); |
Michal Vasko | ef112d7 | 2016-02-18 13:28:25 +0100 | [diff] [blame] | 76 | |
| 77 | /** |
Radek Krejci | 90a84a2 | 2017-05-25 13:53:00 +0200 | [diff] [blame] | 78 | * @brief Get currently set SSH Call Home authentication hostkey check (knownhosts) callback and its private data |
| 79 | * previously set by nc_client_ssh_ch_set_auth_hostkey_check_clb(). |
| 80 | * |
| 81 | * @param[out] auth_hostkey_check Currently set callback, NULL in case of the default callback. |
| 82 | * @param[out] priv Currently set (optional) private data to be passed to the callback function. |
| 83 | */ |
| 84 | void nc_client_ssh_ch_get_auth_hostkey_check_clb(int (**auth_hostkey_check)(const char *hostname, ssh_session session, void *priv), |
Michal Vasko | b83a3fa | 2021-05-26 09:53:42 +0200 | [diff] [blame] | 85 | void **priv); |
Radek Krejci | 90a84a2 | 2017-05-25 13:53:00 +0200 | [diff] [blame] | 86 | /** |
Michal Vasko | 30e2c87 | 2016-02-18 10:03:21 +0100 | [diff] [blame] | 87 | * @brief Set SSH Call Home password authentication callback. |
| 88 | * |
Radek Krejci | 90a84a2 | 2017-05-25 13:53:00 +0200 | [diff] [blame] | 89 | * Repetitive calling causes replacing of the previous callback and its private data. Caller is responsible for |
| 90 | * freeing the private data when necessary (the private data can be obtained by |
| 91 | * nc_client_ssh_ch_get_auth_password_clb()). |
| 92 | * |
Michal Vasko | fdfd9dd | 2016-02-29 10:18:46 +0100 | [diff] [blame] | 93 | * @param[in] auth_password Function to call, returns the password for username\@hostname. |
Michal Vasko | 30e2c87 | 2016-02-18 10:03:21 +0100 | [diff] [blame] | 94 | * If NULL, the default callback is set. |
Radek Krejci | 90a84a2 | 2017-05-25 13:53:00 +0200 | [diff] [blame] | 95 | * @param[in] priv Optional private data to be passed to the callback function. |
Michal Vasko | 30e2c87 | 2016-02-18 10:03:21 +0100 | [diff] [blame] | 96 | */ |
Radek Krejci | 90a84a2 | 2017-05-25 13:53:00 +0200 | [diff] [blame] | 97 | void nc_client_ssh_ch_set_auth_password_clb(char *(*auth_password)(const char *username, const char *hostname, void *priv), |
Michal Vasko | b83a3fa | 2021-05-26 09:53:42 +0200 | [diff] [blame] | 98 | void *priv); |
Radek Krejci | 90a84a2 | 2017-05-25 13:53:00 +0200 | [diff] [blame] | 99 | |
| 100 | /** |
| 101 | * @brief Get currently set SSH Call Home password authentication callback and its private data |
| 102 | * previously set by nc_client_ssh_ch_set_auth_password_clb(). |
| 103 | * |
| 104 | * @param[out] auth_password Currently set callback, NULL in case of the default callback. |
| 105 | * @param[out] priv Currently set (optional) private data to be passed to the callback function. |
| 106 | */ |
| 107 | void nc_client_ssh_ch_get_auth_password_clb(char *(**auth_password)(const char *username, const char *hostname, void *priv), |
Michal Vasko | b83a3fa | 2021-05-26 09:53:42 +0200 | [diff] [blame] | 108 | void **priv); |
Michal Vasko | 30e2c87 | 2016-02-18 10:03:21 +0100 | [diff] [blame] | 109 | |
| 110 | /** |
| 111 | * @brief Set SSH Call Home interactive authentication callback. |
| 112 | * |
Radek Krejci | 90a84a2 | 2017-05-25 13:53:00 +0200 | [diff] [blame] | 113 | * Repetitive calling causes replacing of the previous callback and its private data. Caller is responsible for |
| 114 | * freeing the private data when necessary (the private data can be obtained by |
| 115 | * nc_client_ssh_ch_get_auth_interactive_clb()). |
| 116 | * |
Michal Vasko | 30e2c87 | 2016-02-18 10:03:21 +0100 | [diff] [blame] | 117 | * @param[in] auth_interactive Function to call for every question, returns the answer for |
| 118 | * authentication name with instruction and echoing prompt. |
| 119 | * If NULL, the default callback is set. |
Radek Krejci | 90a84a2 | 2017-05-25 13:53:00 +0200 | [diff] [blame] | 120 | * @param[in] priv Optional private data to be passed to the callback function. |
Michal Vasko | 30e2c87 | 2016-02-18 10:03:21 +0100 | [diff] [blame] | 121 | */ |
| 122 | void nc_client_ssh_ch_set_auth_interactive_clb(char *(*auth_interactive)(const char *auth_name, const char *instruction, |
Michal Vasko | b83a3fa | 2021-05-26 09:53:42 +0200 | [diff] [blame] | 123 | const char *prompt, int echo, void *priv), |
| 124 | void *priv); |
Radek Krejci | 90a84a2 | 2017-05-25 13:53:00 +0200 | [diff] [blame] | 125 | |
| 126 | /** |
| 127 | * @brief Get currently set SSH Call Home interactive authentication callback and its private data |
| 128 | * previously set by nc_client_ssh_ch_set_auth_interactive_clb(). |
| 129 | * |
| 130 | * @param[out] auth_interactive Currently set callback, NULL in case of the default callback. |
| 131 | * @param[out] priv Currently set (optional) private data to be passed to the callback function. |
| 132 | */ |
| 133 | void nc_client_ssh_ch_get_auth_interactive_clb(char *(**auth_interactive)(const char *auth_name, const char *instruction, |
Michal Vasko | b83a3fa | 2021-05-26 09:53:42 +0200 | [diff] [blame] | 134 | const char *prompt, int echo, void *priv), |
| 135 | void **priv); |
Michal Vasko | 30e2c87 | 2016-02-18 10:03:21 +0100 | [diff] [blame] | 136 | |
| 137 | /** |
| 138 | * @brief Set SSH Call Home publickey authentication encrypted private key passphrase callback. |
| 139 | * |
Radek Krejci | 90a84a2 | 2017-05-25 13:53:00 +0200 | [diff] [blame] | 140 | * Repetitive calling causes replacing of the previous callback and its private data. Caller is responsible for |
| 141 | * freeing the private data when necessary (the private data can be obtained by |
| 142 | * nc_client_ssh_ch_get_auth_privkey_passphrase_clb()). |
| 143 | * |
Michal Vasko | 30e2c87 | 2016-02-18 10:03:21 +0100 | [diff] [blame] | 144 | * @param[in] auth_privkey_passphrase Function to call for every question, returns |
| 145 | * the passphrase for the specific private key. |
Radek Krejci | 90a84a2 | 2017-05-25 13:53:00 +0200 | [diff] [blame] | 146 | * @param[in] priv Optional private data to be passed to the callback function. |
Michal Vasko | 30e2c87 | 2016-02-18 10:03:21 +0100 | [diff] [blame] | 147 | */ |
Radek Krejci | 90a84a2 | 2017-05-25 13:53:00 +0200 | [diff] [blame] | 148 | void nc_client_ssh_ch_set_auth_privkey_passphrase_clb(char *(*auth_privkey_passphrase)(const char *privkey_path, void *priv), |
Michal Vasko | b83a3fa | 2021-05-26 09:53:42 +0200 | [diff] [blame] | 149 | void *priv); |
Radek Krejci | 90a84a2 | 2017-05-25 13:53:00 +0200 | [diff] [blame] | 150 | |
| 151 | /** |
| 152 | * @brief Get currently set SSH Call Home publickey authentication encrypted private key passphrase callback and its |
| 153 | * private data previously set by nc_client_ssh_ch_set_auth_privkey_passphrase_clb(). |
| 154 | * |
| 155 | * @param[out] auth_privkey_passphrase Currently set callback, NULL in case of the default callback. |
| 156 | * @param[out] priv Currently set (optional) private data to be passed to the callback function. |
| 157 | */ |
| 158 | void nc_client_ssh_ch_get_auth_privkey_passphrase_clb(char *(**auth_privkey_passphrase)(const char *privkey_path, void *priv), |
Michal Vasko | b83a3fa | 2021-05-26 09:53:42 +0200 | [diff] [blame] | 159 | void **priv); |
Michal Vasko | 30e2c87 | 2016-02-18 10:03:21 +0100 | [diff] [blame] | 160 | |
| 161 | /** |
Michal Vasko | 45f298f | 2016-01-29 10:26:26 +0100 | [diff] [blame] | 162 | * @brief Add a new client bind and start listening on it for SSH Call Home connections. |
| 163 | * |
| 164 | * @param[in] address IP address to bind to. |
| 165 | * @param[in] port Port to bind to. |
| 166 | * @return 0 on success, -1 on error. |
| 167 | */ |
| 168 | int nc_client_ssh_ch_add_bind_listen(const char *address, uint16_t port); |
| 169 | |
| 170 | /** |
| 171 | * @brief Remove an SSH listening client bind. |
| 172 | * |
| 173 | * @param[in] address IP address the socket was bound to. NULL matches all. |
| 174 | * @param[in] port Port the socket was bound to. 0 matches all. |
| 175 | * @return 0 on success, -1 on not found. |
| 176 | */ |
| 177 | int nc_client_ssh_ch_del_bind(const char *address, uint16_t port); |
| 178 | |
| 179 | /** |
| 180 | * @brief Add an SSH public and private key pair to be used for Call Home client authentication. |
| 181 | * |
| 182 | * Private key can be encrypted, the passphrase will be asked for before using it. |
| 183 | * |
Michal Vasko | 45f298f | 2016-01-29 10:26:26 +0100 | [diff] [blame] | 184 | * @param[in] pub_key Path to the public key. |
| 185 | * @param[in] priv_key Path to the private key. |
Michal Vasko | f0537d8 | 2016-01-29 14:42:38 +0100 | [diff] [blame] | 186 | * @return 0 on success, -1 on error. |
Michal Vasko | 45f298f | 2016-01-29 10:26:26 +0100 | [diff] [blame] | 187 | */ |
| 188 | int nc_client_ssh_ch_add_keypair(const char *pub_key, const char *priv_key); |
| 189 | |
| 190 | /** |
| 191 | * @brief Remove an SSH public and private key pair that was used for Call Home client authentication. |
| 192 | * |
Michal Vasko | 45f298f | 2016-01-29 10:26:26 +0100 | [diff] [blame] | 193 | * @param[in] idx Index of the keypair starting with 0. |
Michal Vasko | 45f298f | 2016-01-29 10:26:26 +0100 | [diff] [blame] | 194 | * @return 0 on success, -1 on error. |
| 195 | */ |
| 196 | int nc_client_ssh_ch_del_keypair(int idx); |
| 197 | |
| 198 | /** |
| 199 | * @brief Get the number of public an private key pairs set to be used for Call Home client authentication. |
| 200 | * |
| 201 | * @return Keypair count. |
| 202 | */ |
| 203 | int nc_client_ssh_ch_get_keypair_count(void); |
| 204 | |
| 205 | /** |
| 206 | * @brief Get a specific keypair set to be used for Call Home client authentication. |
| 207 | * |
| 208 | * @param[in] idx Index of the specific keypair. |
| 209 | * @param[out] pub_key Path to the public key. |
| 210 | * @param[out] priv_key Path to the private key. |
Michal Vasko | 45f298f | 2016-01-29 10:26:26 +0100 | [diff] [blame] | 211 | * @return 0 on success, -1 on error. |
| 212 | */ |
| 213 | int nc_client_ssh_ch_get_keypair(int idx, const char **pub_key, const char **priv_key); |
| 214 | |
| 215 | /** |
| 216 | * @brief Set SSH Call Home authentication method preference. |
| 217 | * |
Radek Krejci | 62aa064 | 2017-05-25 16:33:49 +0200 | [diff] [blame] | 218 | * The default preference is as follows: |
| 219 | * - public key authentication (3) |
| 220 | * - password authentication (2) |
| 221 | * - interactive authentication (1) |
| 222 | * |
| 223 | * @param[in] auth_type Authentication method to modify the preference of. |
| 224 | * @param[in] pref Preference of \p auth_type. Higher number increases priority, negative values disable the method. |
Michal Vasko | 45f298f | 2016-01-29 10:26:26 +0100 | [diff] [blame] | 225 | */ |
| 226 | void nc_client_ssh_ch_set_auth_pref(NC_SSH_AUTH_TYPE auth_type, int16_t pref); |
| 227 | |
| 228 | /** |
| 229 | * @brief Get SSH Call Home authentication method preference. |
| 230 | * |
Michal Vasko | 45f298f | 2016-01-29 10:26:26 +0100 | [diff] [blame] | 231 | * @param[in] auth_type Authentication method to retrieve the prefrence of. |
Michal Vasko | 45f298f | 2016-01-29 10:26:26 +0100 | [diff] [blame] | 232 | * @return Preference of the \p auth_type. |
| 233 | */ |
| 234 | int16_t nc_client_ssh_ch_get_auth_pref(NC_SSH_AUTH_TYPE auth_type); |
| 235 | |
| 236 | /** |
| 237 | * @brief Set client Call Home SSH username used for authentication. |
| 238 | * |
| 239 | * @param[in] username Username to use. |
| 240 | * @return 0 on success, -1 on error. |
| 241 | */ |
| 242 | int nc_client_ssh_ch_set_username(const char *username); |
| 243 | |
Michal Vasko | e22c673 | 2016-01-29 11:03:02 +0100 | [diff] [blame] | 244 | /** |
| 245 | * @brief Get client Call Home SSH username used for authentication. |
| 246 | * |
| 247 | * @return Username used. |
| 248 | */ |
| 249 | const char *nc_client_ssh_ch_get_username(void); |
| 250 | |
Radek Krejci | 6799a05 | 2017-05-19 14:23:23 +0200 | [diff] [blame] | 251 | /**@} Client-side Call Home on SSH */ |
| 252 | |
Radek Krejci | 53691be | 2016-02-22 13:58:37 +0100 | [diff] [blame] | 253 | #endif /* NC_ENABLED_SSH */ |
Michal Vasko | 45f298f | 2016-01-29 10:26:26 +0100 | [diff] [blame] | 254 | |
Radek Krejci | 53691be | 2016-02-22 13:58:37 +0100 | [diff] [blame] | 255 | #ifdef NC_ENABLED_TLS |
Michal Vasko | 45f298f | 2016-01-29 10:26:26 +0100 | [diff] [blame] | 256 | |
| 257 | /** |
Radek Krejci | 6799a05 | 2017-05-19 14:23:23 +0200 | [diff] [blame] | 258 | * @defgroup client_ch_tls Client-side Call Home on TLS |
| 259 | * @ingroup client_ch |
| 260 | * |
| 261 | * @brief TLS settings for the Call Home functionality |
| 262 | * @{ |
| 263 | */ |
| 264 | |
| 265 | /** |
Michal Vasko | 45f298f | 2016-01-29 10:26:26 +0100 | [diff] [blame] | 266 | * @brief Add a new client bind and start listening on it for TLS Call Home connections. |
| 267 | * |
| 268 | * @param[in] address IP address to bind to. |
| 269 | * @param[in] port Port to bind to. |
| 270 | * @return 0 on success, -1 on error. |
| 271 | */ |
| 272 | int nc_client_tls_ch_add_bind_listen(const char *address, uint16_t port); |
| 273 | |
| 274 | /** |
| 275 | * @brief Remove a TLS listening client bind. |
| 276 | * |
| 277 | * @param[in] address IP address the socket was bound to. NULL matches all. |
| 278 | * @param[in] port Port the socket was bound to. 0 matches all. |
| 279 | * @return 0 on success, -1 on not found. |
| 280 | */ |
| 281 | int nc_client_tls_ch_del_bind(const char *address, uint16_t port); |
| 282 | |
| 283 | /** |
| 284 | * @brief Set client Call Home authentication identity - a certificate and a private key. |
| 285 | * |
Michal Vasko | e22c673 | 2016-01-29 11:03:02 +0100 | [diff] [blame] | 286 | * @param[in] client_cert Path to the file containing the client certificate. |
Michal Vasko | 45f298f | 2016-01-29 10:26:26 +0100 | [diff] [blame] | 287 | * @param[in] client_key Path to the file containing the private key for the \p client_cert. |
| 288 | * If NULL, key is expected to be stored with \p client_cert. |
Michal Vasko | 45f298f | 2016-01-29 10:26:26 +0100 | [diff] [blame] | 289 | * @return 0 on success, -1 on error. |
| 290 | */ |
Michal Vasko | e22c673 | 2016-01-29 11:03:02 +0100 | [diff] [blame] | 291 | int nc_client_tls_ch_set_cert_key_paths(const char *client_cert, const char *client_key); |
| 292 | |
| 293 | /** |
| 294 | * @brief Get client Call Home authentication identity - a certificate and a private key. |
| 295 | * |
Michal Vasko | e22c673 | 2016-01-29 11:03:02 +0100 | [diff] [blame] | 296 | * @param[out] client_cert Path to the file containing the client certificate. Can be NULL. |
| 297 | * @param[out] client_key Path to the file containing the private key for the \p client_cert. |
| 298 | * Can be NULL. |
| 299 | */ |
| 300 | void nc_client_tls_ch_get_cert_key_paths(const char **client_cert, const char **client_key); |
Michal Vasko | 45f298f | 2016-01-29 10:26:26 +0100 | [diff] [blame] | 301 | |
| 302 | /** |
| 303 | * @brief Set client Call Home trusted CA certificates. |
| 304 | * |
| 305 | * @param[in] ca_file Location of the CA certificate file used to verify server certificates. |
| 306 | * For more info, see the documentation for SSL_CTX_load_verify_locations() from OpenSSL. |
| 307 | * @param[in] ca_dir Location of the CA certificates directory used to verify the server certificates. |
| 308 | * For more info, see the documentation for SSL_CTX_load_verify_locations() from OpenSSL. |
| 309 | * @return 0 on success, -1 on error. |
| 310 | */ |
Michal Vasko | e22c673 | 2016-01-29 11:03:02 +0100 | [diff] [blame] | 311 | int nc_client_tls_ch_set_trusted_ca_paths(const char *ca_file, const char *ca_dir); |
| 312 | |
| 313 | /** |
| 314 | * @brief Get client Call Home trusted CA certificates. |
| 315 | * |
| 316 | * @param[out] ca_file Location of the CA certificate file used to verify server certificates. |
| 317 | * Can be NULL. |
| 318 | * @param[out] ca_dir Location of the CA certificates directory used to verify the server certificates. |
| 319 | * Can be NULL. |
| 320 | */ |
| 321 | void nc_client_tls_ch_get_trusted_ca_paths(const char **ca_file, const char **ca_dir); |
Michal Vasko | 45f298f | 2016-01-29 10:26:26 +0100 | [diff] [blame] | 322 | |
| 323 | /** |
| 324 | * @brief Set client Call Home Certificate Revocation Lists. |
| 325 | * |
| 326 | * @param[in] crl_file Location of the CRL certificate file used to check for revocated certificates. |
| 327 | * @param[in] crl_dir Location of the CRL certificate directory used to check for revocated certificates. |
| 328 | * @return 0 on success, -1 on error. |
| 329 | */ |
Michal Vasko | e22c673 | 2016-01-29 11:03:02 +0100 | [diff] [blame] | 330 | int nc_client_tls_ch_set_crl_paths(const char *crl_file, const char *crl_dir); |
| 331 | |
| 332 | /** |
| 333 | * @brief Get client Call Home Certificate Revocation Lists. |
| 334 | * |
| 335 | * @param[out] crl_file Location of the CRL certificate file used to check for revocated certificates. |
| 336 | * Can be NULL. |
| 337 | * @param[out] crl_dir Location of the CRL certificate directory used to check for revocated certificates. |
| 338 | * Can be NULL. |
| 339 | */ |
| 340 | void nc_client_tls_ch_get_crl_paths(const char **crl_file, const char **crl_dir); |
Michal Vasko | 45f298f | 2016-01-29 10:26:26 +0100 | [diff] [blame] | 341 | |
Radek Krejci | 6799a05 | 2017-05-19 14:23:23 +0200 | [diff] [blame] | 342 | /**@} Client-side Call Home on TLS */ |
| 343 | |
Radek Krejci | 53691be | 2016-02-22 13:58:37 +0100 | [diff] [blame] | 344 | #endif /* NC_ENABLED_TLS */ |
Michal Vasko | 45f298f | 2016-01-29 10:26:26 +0100 | [diff] [blame] | 345 | |
Michal Vasko | c09730e | 2019-01-17 10:07:26 +0100 | [diff] [blame] | 346 | #ifdef __cplusplus |
| 347 | } |
| 348 | #endif |
| 349 | |
Michal Vasko | 45f298f | 2016-01-29 10:26:26 +0100 | [diff] [blame] | 350 | #endif /* NC_SESSION_CLIENT_CH_H_ */ |