KeyringMemory class.
More...
#include <keyring_memory.h>
|
| | KeyringMemory ()=default |
| |
| std::vector< char > | serialize (const std::string &key) const |
| | Serializes and encrypts keyring data to memory buffer. More...
|
| |
| void | parse (const std::string &key, const char *buffer, std::size_t buffer_size) |
| | Parses and decrypts keyring data. More...
|
| |
| void | store (const std::string &uid, const std::string &attribute, const std::string &value) override |
| | Stores an attribute value in an entry. More...
|
| |
| std::string | fetch (const std::string &uid, const std::string &attribute) const override |
| | Retrieves attribute value from an entry. More...
|
| |
| bool | remove (const std::string &uid) override |
| | Removes an entry. More...
|
| |
| bool | remove_attribute (const std::string &uid, const std::string &attribute) override |
| | Removes an attribute from an entry. More...
|
| |
| const std::map< std::string, std::map< std::string, std::string > > & | entries () const |
| |
| | Keyring ()=default |
| |
| | Keyring (const Keyring &)=default |
| |
| Keyring & | operator= (const Keyring &)=default |
| |
| virtual | ~Keyring ()=default |
| |
|
| std::map< std::string, std::map< std::string, std::string > > | entries_ |
| |
KeyringMemory class.
Implements Keyring interface and provides additional methods for parsing and serialization using a simple binary format. Also, handles AES encryption. Used primarily for testing and as a base for KeyringFile.
◆ KeyringMemory()
| mysql_harness::KeyringMemory::KeyringMemory |
( |
| ) |
|
|
default |
◆ entries()
| const std::map< std::string, std::map< std::string, std::string > > & mysql_harness::KeyringMemory::entries |
( |
| ) |
const |
|
inline |
◆ fetch()
| std::string mysql_harness::KeyringMemory::fetch |
( |
const std::string & |
uid, |
|
|
const std::string & |
attribute |
|
) |
| const |
|
overridevirtual |
Retrieves attribute value from an entry.
- Parameters
-
| [in] | uid | Entry id. |
| [in] | attribute | Attribute id. |
- Returns
- Attribute value.
- Exceptions
-
| std::out_of_range | Attribute not found. |
Implements mysql_harness::Keyring.
◆ parse()
| void mysql_harness::KeyringMemory::parse |
( |
const std::string & |
key, |
|
|
const char * |
buffer, |
|
|
std::size_t |
buffer_size |
|
) |
| |
Parses and decrypts keyring data.
- Parameters
-
| [in] | key | Key used for decryption. |
| [in] | buffer | Serialized keyring data. |
| [in] | buffer_size | Size of the data. |
- Exceptions
-
| std::exception | Parsing failed. |
◆ remove()
| bool mysql_harness::KeyringMemory::remove |
( |
const std::string & |
uid | ) |
|
|
overridevirtual |
Removes an entry.
- Parameters
-
- Returns
- success
- Return values
-
| true | uid removed |
| false | uid not removed |
Implements mysql_harness::Keyring.
◆ remove_attribute()
| bool mysql_harness::KeyringMemory::remove_attribute |
( |
const std::string & |
uid, |
|
|
const std::string & |
attribute |
|
) |
| |
|
overridevirtual |
Removes an attribute from an entry.
- Parameters
-
| [in] | uid | Entry id. |
| [in] | attribute | Attribute id. |
- Returns
- success
- Return values
-
| true | uid removed |
| false | uid not removed |
Implements mysql_harness::Keyring.
◆ serialize()
| std::vector< char > mysql_harness::KeyringMemory::serialize |
( |
const std::string & |
key | ) |
const |
Serializes and encrypts keyring data to memory buffer.
- Parameters
-
| [in] | key | Key used for encryption. |
- Returns
- Serialized keyring data.
- Exceptions
-
| std::exception | Serialization failed. |
◆ store()
| void mysql_harness::KeyringMemory::store |
( |
const std::string & |
uid, |
|
|
const std::string & |
attribute, |
|
|
const std::string & |
value |
|
) |
| |
|
overridevirtual |
Stores an attribute value in an entry.
- Parameters
-
| [in] | uid | Entry id. |
| [in] | attribute | Attribute id. |
| [in] | value | Attribute value. |
Implements mysql_harness::Keyring.
◆ entries_
| std::map<std::string, std::map<std::string, std::string> > mysql_harness::KeyringMemory::entries_ |
|
private |
◆ kFormatVersion
| constexpr static unsigned int mysql_harness::KeyringMemory::kFormatVersion = 0 |
|
staticconstexpr |
The documentation for this class was generated from the following files: