7#include <botan/psk_db.h>
9#include <botan/database.h>
14 std::shared_ptr<SQL_Database> db,
15 std::string_view table_name) :
17 m_db->create_table(
"create table if not exists " + m_table_name +
"(psk_name TEXT PRIMARY KEY, psk_value TEXT)");
22void Encrypted_PSK_Database_SQL::kv_del(std::string_view
name) {
23 auto stmt = m_db->new_statement(
"delete from " + m_table_name +
" where psk_name=?1");
28void Encrypted_PSK_Database_SQL::kv_set(std::string_view
name, std::string_view value) {
29 auto stmt = m_db->new_statement(
"insert or replace into " + m_table_name +
" values(?1, ?2)");
37std::string Encrypted_PSK_Database_SQL::kv_get(std::string_view
name)
const {
38 auto stmt = m_db->new_statement(
"select psk_value from " + m_table_name +
" where psk_name = ?1");
43 return stmt->get_str(0);
48std::set<std::string> Encrypted_PSK_Database_SQL::kv_get_all()
const {
49 std::set<std::string> names;
51 auto stmt = m_db->new_statement(
"select psk_name from " + m_table_name);
54 names.insert(stmt->get_str(0));
Encrypted_PSK_Database_SQL(const secure_vector< uint8_t > &master_key, std::shared_ptr< SQL_Database > db, std::string_view table_name)
~Encrypted_PSK_Database_SQL() override
std::vector< T, secure_allocator< T > > secure_vector