24#ifndef KEYRING_WRITER_SERVICE_IMPL_TEMPLATE_INCLUDED
25#define KEYRING_WRITER_SERVICE_IMPL_TEMPLATE_INCLUDED
32#include <mysqld_error.h>
62template <
typename Backend,
typename Data_extension = data::Data>
64 const char *data_id,
const char *auth_id,
const unsigned char *data,
65 size_t data_size,
const char *data_type,
71 ER_NOTE_KEYRING_COMPONENT_NOT_INITIALIZED);
75 if (data_id ==
nullptr || !*data_id) {
77 ER_NOTE_KEYRING_COMPONENT_EMPTY_DATA_ID);
84 ER_NOTE_KEYRING_COMPONENT_WRITE_MAXIMUM_DATA_LENGTH,
90 Data data_to_be_stored({
reinterpret_cast<const char *
>(data), data_size},
91 {data_type, data_type ? strlen(data_type) : 0});
92 if (keyring_operations.
store(metadata, data_to_be_stored)) {
95 (auth_id ==
nullptr || !*auth_id) ?
"NULL" : auth_id);
100 LogComponentErr(
ERROR_LEVEL, ER_KEYRING_COMPONENT_EXCEPTION,
"store",
119template <
typename Backend,
typename Data_extension = data::Data>
121 const char *data_id,
const char *auth_id,
127 ER_NOTE_KEYRING_COMPONENT_NOT_INITIALIZED);
131 if (data_id ==
nullptr || !*data_id) {
133 ER_NOTE_KEYRING_COMPONENT_EMPTY_DATA_ID);
138 Metadata metadata(data_id, auth_id);
139 if (keyring_operations.
erase(metadata)) {
141 ER_NOTE_KEYRING_COMPONENT_REMOVE_FAILED, data_id,
142 (auth_id ==
nullptr || !*auth_id) ?
"NULL" : auth_id);
147 LogComponentErr(
ERROR_LEVEL, ER_KEYRING_COMPONENT_EXCEPTION,
"remove",
Sensitive data storage.
Definition: data.h:39
Keyring operations A class to perform operations on keyring.
Definition: operations.h:482
bool erase(const meta::Metadata &metadata)
Remove API.
Definition: operations.h:609
bool store(const meta::Metadata &metadata, const data::Data &data)
Store API.
Definition: operations.h:570
size_t maximum_data_length() const
Maximum data length supported.
Definition: operations.h:778
Definition: service_requirements.h:35
bool keyring_initialized()
Keyring component status.
Definition: component_callbacks.cc:28
@ ERROR_LEVEL
Definition: my_loglevel.h:43
@ INFORMATION_LEVEL
Definition: my_loglevel.h:45
Definition: keyring_encryption_service_impl_template.h:56
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:63
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:120