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,
72 ER_NOTE_KEYRING_COMPONENT_NOT_INITIALIZED);
76 if (data_id ==
nullptr || !*data_id) {
78 ER_NOTE_KEYRING_COMPONENT_EMPTY_DATA_ID);
85 ER_NOTE_KEYRING_COMPONENT_WRITE_MAXIMUM_DATA_LENGTH,
91 Data data_to_be_stored({
reinterpret_cast<const char *
>(data), data_size},
92 {data_type, data_type ? strlen(data_type) : 0});
93 if (keyring_operations.
store(metadata, data_to_be_stored) ==
true) {
96 (auth_id ==
nullptr || !*auth_id) ?
"NULL" : auth_id);
101 LogComponentErr(
ERROR_LEVEL, ER_KEYRING_COMPONENT_EXCEPTION,
"store",
120template <
typename Backend,
typename Data_extension = data::Data>
122 const char *data_id,
const char *auth_id,
128 ER_NOTE_KEYRING_COMPONENT_NOT_INITIALIZED);
132 if (data_id ==
nullptr || !*data_id) {
134 ER_NOTE_KEYRING_COMPONENT_EMPTY_DATA_ID);
139 Metadata metadata(data_id, auth_id);
140 if (keyring_operations.
erase(metadata) ==
true) {
142 ER_NOTE_KEYRING_COMPONENT_REMOVE_FAILED, data_id,
143 (auth_id ==
nullptr || !*auth_id) ?
"NULL" : auth_id);
148 LogComponentErr(
ERROR_LEVEL, ER_KEYRING_COMPONENT_EXCEPTION,
"remove",
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
bool keyring_initialized()
Keyring component status.
Definition: component_callbacks.cc:29
@ 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:121
Definition: keyring_encryption_service_definition.h:32