Botan 2.13.0 Crypto and TLS for C++11

- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | List of all members
Botan::PSK_Database Class Referenceabstract

`#include <psk_db.h>`

Inheritance diagram for Botan::PSK_Database:

## Public Member Functions
virtual secure_vector< uint8_t > | get (const std::string &name) const =0
std::string | get_str (const std::string &name) const
virtual bool | is_encrypted () const =0
virtual std::set< std::string > | list_names () const =0
virtual void | remove (const std::string &name)=0
virtual void | set (const std::string &name, const uint8_t psk[], size_t psk_len)=0
void | set_str (const std::string &name, const std::string &psk)
template<typename Alloc >
void | set_vec (const std::string &name, const std::vector< uint8_t, Alloc > &psk)
virtual | ~PSK_Database ()=default

## Detailed Description

This is an interface to a generic PSK (pre-shared key) database. It might be implemented as a plaintext storage or via some mechanism that encrypts the keys and/or values.

Definition at line 25 of file psk_db.h.

## Constructor & Destructor Documentation

virtual Botan::PSK_Database::~PSK_Database | ( |  | ) |
| virtual default

## Member Function Documentation

virtual secure_vector<uint8_t> Botan::PSK_Database::get | ( | const std::string & | name | ) | const
| pure virtual

Return the value associated with the specified

Parameters

  name | or otherwise throw an exception.

Implemented in Botan::Encrypted_PSK_Database.

std::string Botan::PSK_Database::get_str | ( | const std::string & | name | ) | const
| inline

Get a PSK in the form of a string (eg if the PSK is a password)

Definition at line 59 of file psk_db.h.

References Botan::cast_uint8_ptr_to_char(), and name.

60 {
61 secure_vector<uint8_t> psk = get(name);
62 return std::string(cast_uint8_ptr_to_char(psk.data()), psk.size());
63 }
name
std::string name
Definition: commoncrypto_hash.cpp:23
Botan::cast_uint8_ptr_to_char
const char * cast_uint8_ptr_to_char(const uint8_t *b)
Definition: mem_ops.h:194

virtual bool Botan::PSK_Database::is_encrypted | ( |  | ) | const
| pure virtual

Returns if the values in the PSK database are encrypted. If false, saved values are being stored in plaintext.

Implemented in Botan::Encrypted_PSK_Database.

virtual std::set<std::string> Botan::PSK_Database::list_names | ( |  | ) | const
| pure virtual

Return the set of names for which get() will return a value.

Implemented in Botan::Encrypted_PSK_Database.

virtual void Botan::PSK_Database::remove | ( | const std::string & | name | ) |
| pure virtual

Remove a PSK from the database

Implemented in Botan::Encrypted_PSK_Database.

virtual void Botan::PSK_Database::set | ( | const std::string & | name,
|  | const uint8_t | psk[],
|  | size_t | psk_len
| ) |  |
| pure virtual

Set a value that can later be accessed with get(). If name already exists in the database, the old value will be overwritten.

Implemented in Botan::Encrypted_PSK_Database.

void Botan::PSK_Database::set_str | ( | const std::string & | name,
|  | const std::string & | psk
| ) |  |
| inline

Definition at line 65 of file psk_db.h.

References Botan::cast_char_ptr_to_uint8().

66 {
67 set(name, cast_char_ptr_to_uint8(psk.data()), psk.size());
68 }
Botan::cast_char_ptr_to_uint8
const uint8_t * cast_char_ptr_to_uint8(const char *s)
Definition: mem_ops.h:189
Botan::PSK_Database::set
virtual void set(const std::string &name, const uint8_t psk[], size_t psk_len)=0
name
std::string name
Definition: commoncrypto_hash.cpp:23
template<typename Alloc >

void Botan::PSK_Database::set_vec | ( | const std::string & | name,
|  | const std::vector< uint8_t, Alloc > & | psk
| ) |  |
| inline

Definition at line 71 of file psk_db.h.

74 {
75 set(name, psk.data(), psk.size());
76 }
Botan::PSK_Database::set
virtual void set(const std::string &name, const uint8_t psk[], size_t psk_len)=0
name
std::string name
Definition: commoncrypto_hash.cpp:23

The documentation for this class was generated from the following file:

- src/lib/psk_db/psk_db.h