* This function sets the secret cache value for a given secret name. This allows * plugins to load cert/key PEM information on for use by the TLS core */
| 8039 | * plugins to load cert/key PEM information on for use by the TLS core |
| 8040 | */ |
| 8041 | TSReturnCode |
| 8042 | TSSslSecretSet(const char *secret_name, int secret_name_length, const char *secret_data, int secret_data_len) |
| 8043 | { |
| 8044 | TSReturnCode retval = TS_SUCCESS; |
| 8045 | std::string const secret_name_str{secret_name, static_cast<unsigned>(secret_name_length)}; |
| 8046 | SSLConfigParams *load_params = SSLConfig::load_acquire(); |
| 8047 | SSLConfigParams *params = SSLConfig::acquire(); |
| 8048 | if (load_params != nullptr) { // Update the current data structure |
| 8049 | Dbg(dbg_ctl_ssl_cert_update, "Setting secrets in SSLConfig load for: %.*s", secret_name_length, secret_name); |
| 8050 | load_params->secrets.setSecret(secret_name_str, std::string_view(secret_data, secret_data_len)); |
| 8051 | load_params->updateCTX(secret_name_str); |
| 8052 | SSLConfig::load_release(load_params); |
| 8053 | } |
| 8054 | if (params != nullptr) { |
| 8055 | Dbg(dbg_ctl_ssl_cert_update, "Setting secrets in SSLConfig for: %.*s", secret_name_length, secret_name); |
| 8056 | params->secrets.setSecret(secret_name_str, std::string_view(secret_data, secret_data_len)); |
| 8057 | params->updateCTX(secret_name_str); |
| 8058 | SSLConfig::release(params); |
| 8059 | } |
| 8060 | return retval; |
| 8061 | } |
| 8062 | |
| 8063 | TSReturnCode |
| 8064 | TSSslSecretUpdate(const char *secret_name, int secret_name_length) |