MySQL 9.1.0
Source Code Documentation
mysql_harness::KeyringMemory Class Reference

KeyringMemory class. More...

#include <keyring_memory.h>

Inheritance diagram for mysql_harness::KeyringMemory:
[legend]

Public Member Functions

 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
 
- Public Member Functions inherited from mysql_harness::Keyring
 Keyring ()=default
 
 Keyring (const Keyring &)=default
 
Keyringoperator= (const Keyring &)=default
 
virtual ~Keyring ()=default
 

Static Public Attributes

constexpr static unsigned int kFormatVersion = 0
 

Private Attributes

std::map< std::string, std::map< std::string, std::string > > entries_
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ KeyringMemory()

mysql_harness::KeyringMemory::KeyringMemory ( )
default

Member Function Documentation

◆ 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]uidEntry id.
[in]attributeAttribute id.
Returns
Attribute value.
Exceptions
std::out_of_rangeAttribute 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]keyKey used for decryption.
[in]bufferSerialized keyring data.
[in]buffer_sizeSize of the data.
Exceptions
std::exceptionParsing failed.

◆ remove()

bool mysql_harness::KeyringMemory::remove ( const std::string &  uid)
overridevirtual

Removes an entry.

Parameters
[in]uidEntry id.
Returns
success
Return values
trueuid removed
falseuid 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]uidEntry id.
[in]attributeAttribute id.
Returns
success
Return values
trueuid removed
falseuid 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]keyKey used for encryption.
Returns
Serialized keyring data.
Exceptions
std::exceptionSerialization 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]uidEntry id.
[in]attributeAttribute id.
[in]valueAttribute value.

Implements mysql_harness::Keyring.

Member Data Documentation

◆ 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: