File containing the definition of the sqlite crypt writer utilities.
More...
#include <stdint.h>
#include <sqlite3.h>
Go to the source code of this file.
|
#define | CRYPT_STORE_TABLE_NAME "store" |
|
#define | CRYPT_STORE_CREATE_TABLE |
|
#define | CRYPT_STORE_INSERT_INTO "INSERT INTO " CRYPT_STORE_TABLE_NAME " VALUES(@key, @value, @id, @iv);" |
|
#define | CRYPT_STORE_DELETE_FROM "DELETE FROM " CRYPT_STORE_TABLE_NAME " WHERE key=@key;" |
|
#define | CRYPT_STORE_GET "SELECT value, id, iv FROM " CRYPT_STORE_TABLE_NAME " WHERE key=?;" |
|
#define | CRYPT_SECRETS_TABLE_NAME "secrets" |
|
#define | CRYPT_SECRETS_CREATE_TABLE |
|
#define | CRYPT_SECRETS_INSERT_INTO "INSERT INTO " CRYPT_SECRETS_TABLE_NAME " VALUES(@id, @value, @salt, @iv);" |
|
#define | CRYPT_SECRETS_GET "SELECT value, salt, iv FROM " CRYPT_SECRETS_TABLE_NAME " WHERE id=?;" |
|
File containing the definition of the sqlite crypt writer utilities.
- Author
- Alexandru Mereacre
- Date
- 2021
- Copyright
- SPDX-FileCopyrightText: © 2021 NQMCyber Ltd and edgesec contributors SPDX-License-Identifier: LGPL-3.0-or-later
◆ CRYPT_SECRETS_CREATE_TABLE
#define CRYPT_SECRETS_CREATE_TABLE |
Value:
" (id TEXT NOT NULL, value TEXT, salt TEXT, iv TEXT, " \
"PRIMARY KEY (id));"
#define CRYPT_SECRETS_TABLE_NAME
Definition: sqlite_crypt_writer.h:29
◆ CRYPT_SECRETS_GET
#define CRYPT_SECRETS_GET "SELECT value, salt, iv FROM " CRYPT_SECRETS_TABLE_NAME " WHERE id=?;" |
◆ CRYPT_SECRETS_INSERT_INTO
#define CRYPT_SECRETS_INSERT_INTO "INSERT INTO " CRYPT_SECRETS_TABLE_NAME " VALUES(@id, @value, @salt, @iv);" |
◆ CRYPT_SECRETS_TABLE_NAME
#define CRYPT_SECRETS_TABLE_NAME "secrets" |
◆ CRYPT_STORE_CREATE_TABLE
#define CRYPT_STORE_CREATE_TABLE |
Value:
" (key TEXT NOT NULL, value TEXT, id TEXT, iv TEXT, " \
"PRIMARY KEY (key));"
#define CRYPT_STORE_TABLE_NAME
Definition: sqlite_crypt_writer.h:17
◆ CRYPT_STORE_DELETE_FROM
#define CRYPT_STORE_DELETE_FROM "DELETE FROM " CRYPT_STORE_TABLE_NAME " WHERE key=@key;" |
◆ CRYPT_STORE_GET
#define CRYPT_STORE_GET "SELECT value, id, iv FROM " CRYPT_STORE_TABLE_NAME " WHERE key=?;" |
◆ CRYPT_STORE_INSERT_INTO
#define CRYPT_STORE_INSERT_INTO "INSERT INTO " CRYPT_STORE_TABLE_NAME " VALUES(@key, @value, @id, @iv);" |
◆ CRYPT_STORE_TABLE_NAME
#define CRYPT_STORE_TABLE_NAME "store" |
◆ free_sqlite_crypt_db()
void free_sqlite_crypt_db |
( |
sqlite3 * |
db | ) |
|
Closes the sqlite db.
- Parameters
-
db | The sqlite db structure pointer |
◆ free_sqlite_secrets_row()
void free_sqlite_secrets_row |
( |
struct secrets_row * |
row | ) |
|
Frees a secrets row entry.
- Parameters
-
◆ free_sqlite_store_row()
void free_sqlite_store_row |
( |
struct store_row * |
row | ) |
|
Frees a store row entry.
- Parameters
-
◆ get_sqlite_secrets_row()
struct secrets_row* get_sqlite_secrets_row |
( |
sqlite3 * |
db, |
|
|
const char * |
id |
|
) |
| |
Get the sqlite secrets entry object.
- Parameters
-
db | The sqlite db structure pointer |
id | The secrets column id |
- Returns
- struct secrets_row* row value, NULL on failure
◆ get_sqlite_store_row()
struct store_row* get_sqlite_store_row |
( |
sqlite3 * |
db, |
|
|
const char * |
key |
|
) |
| |
Get the sqlite store entry object.
- Parameters
-
db | The sqlite db structure pointer |
key | The store column key |
- Returns
- struct store_row* row value, NULL on failure
◆ open_sqlite_crypt_db()
int open_sqlite_crypt_db |
( |
const char * |
db_path, |
|
|
sqlite3 ** |
sql |
|
) |
| |
Opens the sqlite crypt db.
- Parameters
-
| db_path | The sqlite db path |
[out] | sql | The returned sqlite db structure pointer |
- Returns
- 0 on success, -1 on failure
◆ save_sqlite_secrets_entry()
int save_sqlite_secrets_entry |
( |
sqlite3 * |
db, |
|
|
struct secrets_row * |
row |
|
) |
| |
Save a secrets entry into the sqlite db.
- Parameters
-
db | The sqlite db structure pointer |
row | The secrets row structure |
- Returns
- int 0 on success, -1 on failure
◆ save_sqlite_store_entry()
int save_sqlite_store_entry |
( |
sqlite3 * |
db, |
|
|
struct store_row * |
row |
|
) |
| |
Save a store entry into the sqlite db.
- Parameters
-
db | The sqlite db structure pointer |
row | The store row structure |
- Returns
- int 0 on success, -1 on failure