24#ifndef KEYRING_WRITER_SERVICE_IMPL_TEMPLATE_INCLUDED
25#define KEYRING_WRITER_SERVICE_IMPL_TEMPLATE_INCLUDED
32#include <mysqld_error.h>
40namespace service_implementation {
63template <
typename Backend,
typename Data_extension = data::Data>
65 const char *data_id,
const char *auth_id,
const unsigned char *data,
66 size_t data_size,
const char *data_type,
70 if (
callbacks.keyring_initialized() ==
false) {
74 if (data_id ==
nullptr || !*data_id) {
81 ER_NOTE_KEYRING_COMPONENT_WRITE_MAXIMUM_DATA_LENGTH,
87 Data data_to_be_stored({
reinterpret_cast<const char *
>(data), data_size},
88 {data_type, data_type ? strlen(data_type) : 0});
89 if (keyring_operations.
store(metadata, data_to_be_stored) ==
true) {
92 (auth_id ==
nullptr || !*auth_id) ?
"NULL" : auth_id);
97 LogComponentErr(
ERROR_LEVEL, ER_KEYRING_COMPONENT_EXCEPTION,
"store",
116template <
typename Backend,
typename Data_extension = data::Data>
118 const char *data_id,
const char *auth_id,
122 if (
callbacks.keyring_initialized() ==
false) {
126 if (data_id ==
nullptr || !*data_id) {
131 Metadata metadata(data_id, auth_id);
132 if (keyring_operations.
erase(metadata) ==
true) {
134 ER_NOTE_KEYRING_COMPONENT_REMOVE_FAILED, data_id,
135 (auth_id ==
nullptr || !*auth_id) ?
"NULL" : auth_id);
140 LogComponentErr(
ERROR_LEVEL, ER_KEYRING_COMPONENT_EXCEPTION,
"remove",
static const sasl_callback_t callbacks[]
Definition: auth_ldap_sasl_client.h:45
Sensitive data storage.
Definition: data.h:40
Keyring operations A class to perform operations on keyring.
Definition: operations.h:483
bool erase(const meta::Metadata &metadata)
Remove API.
Definition: operations.h:610
bool store(const meta::Metadata &metadata, const data::Data &data)
Store API.
Definition: operations.h:571
size_t maximum_data_length() const
Maximum data length supported.
Definition: operations.h:779
Definition: service_requirements.h:36
@ ERROR_LEVEL
Definition: my_loglevel.h:43
@ INFORMATION_LEVEL
Definition: my_loglevel.h:45
bool store_template(const char *data_id, const char *auth_id, const unsigned char *data, size_t data_size, const char *data_type, Keyring_operations< Backend, Data_extension > &keyring_operations, Component_callbacks &callbacks)
Store data in keyring.
Definition: keyring_writer_service_impl_template.h:64
bool remove_template(const char *data_id, const char *auth_id, Keyring_operations< Backend, Data_extension > &keyring_operations, Component_callbacks &callbacks)
Remove data from keyring.
Definition: keyring_writer_service_impl_template.h:117
Definition: keyring_encryption_service_definition.h:32