1 /* Copyright (c) 2016, 2021, Oracle and/or its affiliates.
2 
3    This program is free software; you can redistribute it and/or modify
4    it under the terms of the GNU General Public License, version 2.0,
5    as published by the Free Software Foundation.
6 
7    This program is also distributed with certain software (including
8    but not limited to OpenSSL) that is licensed under separate terms,
9    as designated in a particular file or component or in included license
10    documentation.  The authors of MySQL hereby grant you an additional
11    permission to link the program and your derivative works with the
12    separately licensed software that they have included with MySQL.
13 
14    This program is distributed in the hope that it will be useful,
15    but WITHOUT ANY WARRANTY; without even the implied warranty of
16    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17    GNU General Public License, version 2.0, for more details.
18 
19    You should have received a copy of the GNU General Public License
20    along with this program; if not, write to the Free Software
21    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA */
22 
23 #ifndef MYSQL_I_KEY_H
24 #define MYSQL_I_KEY_H
25 
26 #include <string>
27 #include "keyring_memory.h"
28 
29 namespace keyring {
30 
31 struct IKey : public Keyring_alloc
32 {
33   //key_signature:= key_id || user_id
34   virtual std::string* get_key_signature() const= 0;
35   virtual std::string* get_key_type()= 0;
36   virtual std::string* get_key_id()= 0;
37   virtual std::string* get_user_id()= 0;
38   virtual uchar* get_key_data()= 0;
39   virtual size_t get_key_data_size()= 0;
40   virtual size_t get_key_pod_size() const = 0;
41   virtual uchar* release_key_data()= 0;
42   virtual void xor_data()= 0;
43   virtual void set_key_data(uchar *key_data, size_t key_data_size)= 0;
44   virtual void set_key_type(const std::string *key_type)= 0;
45   virtual my_bool load_from_buffer(uchar* buffer, size_t *buffer_position,
46                                    size_t input_buffer_size)= 0;
47   virtual void store_in_buffer(uchar* buffer, size_t *buffer_position) const = 0;
48   virtual my_bool is_key_type_valid()= 0;
49   virtual my_bool is_key_id_valid()= 0;
50   virtual my_bool is_key_valid()= 0;
51   virtual my_bool is_key_length_valid()= 0;
52 
~IKeyIKey53   virtual ~IKey() {}
54 };
55 
56 }//namespace keyring
57 #endif //MYSQL_I_KEY_H
58