MySQL 8.0.39
Source Code Documentation
keyring_operations_helper.h
Go to the documentation of this file.
1/* Copyright (c) 2021, 2024, Oracle and/or its affiliates.
2
3This program is free software; you can redistribute it and/or modify
4it under the terms of the GNU General Public License, version 2.0,
5as published by the Free Software Foundation.
6
7This program is designed to work with certain software (including
8but not limited to OpenSSL) that is licensed under separate terms,
9as designated in a particular file or component or in included license
10documentation. The authors of MySQL hereby grant you an additional
11permission to link the program and your derivative works with the
12separately licensed software that they have either included with
13the program or referenced in the documentation.
14
15This program is distributed in the hope that it will be useful,
16but WITHOUT ANY WARRANTY; without even the implied warranty of
17MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18GNU General Public License, version 2.0, for more details.
19
20You should have received a copy of the GNU General Public License
21along with this program; if not, write to the Free Software
22Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
23
24#ifndef KEYRING_OPERATIONS_HELPER_INCLUDED
25#define KEYRING_OPERATIONS_HELPER_INCLUDED
26
30#include "my_sys.h"
31#include "scope_guard.h"
32
34
35/**
36 Read secret from keyring
37
38 Note: Memory for secert and secret_type must be freed by the caller
39
40 @param [in] keyring_reader Handle to keyring_reader_with_status service
41 @param [in] secret_id Identifier for secret data
42 @param [in] auth_id Owner of secret data - nullptr for internal keys
43 @param [out] secret Output buffer for secret fetched from keyring
44 @param [out] secret_length Length of secret data
45 @param [out] secret_type Type of data
46 @param [out] psi_memory_key Memory key to be used to allocate memory for
47 secret and secret_type
48
49 @returns status of reading secret
50 @retval -1 Keyring error
51 @retval 0 Key absent
52 @retval 1 Key present. Check output buffers.
53*/
54int read_secret(SERVICE_TYPE(keyring_reader_with_status) * keyring_reader,
55 const char *secret_id, const char *auth_id,
56 unsigned char **secret, size_t *secret_length,
57 char **secret_type, PSI_memory_key psi_memory_key);
58} // namespace keyring_operations_helper
59
60#endif /* KEYRING_OPERATIONS_HELPER_INCLUDED */
unsigned int PSI_memory_key
Instrumented memory key.
Definition: psi_memory_bits.h:49
Common header for many mysys elements.
Definition: keyring_operations_helper.h:33
int read_secret(const mysql_service_keyring_reader_with_status_t *keyring_reader, const char *secret_id, const char *auth_id, unsigned char **secret, size_t *secret_length, char **secret_type, PSI_memory_key psi_memory_key)
Read secret from keyring.
Definition: keyring_operations_helper.cc:30
#define SERVICE_TYPE(name)
Generates the standard Service type name.
Definition: service.h:76