11 #ifndef SQLITE_CRYPT_WRITER_H
12 #define SQLITE_CRYPT_WRITER_H
17 #define CRYPT_STORE_TABLE_NAME "store"
18 #define CRYPT_STORE_CREATE_TABLE \
19 "CREATE TABLE " CRYPT_STORE_TABLE_NAME \
20 " (key TEXT NOT NULL, value TEXT, id TEXT, iv TEXT, " \
22 #define CRYPT_STORE_INSERT_INTO \
23 "INSERT INTO " CRYPT_STORE_TABLE_NAME " VALUES(@key, @value, @id, @iv);"
24 #define CRYPT_STORE_DELETE_FROM \
25 "DELETE FROM " CRYPT_STORE_TABLE_NAME " WHERE key=@key;"
26 #define CRYPT_STORE_GET \
27 "SELECT value, id, iv FROM " CRYPT_STORE_TABLE_NAME " WHERE key=?;"
29 #define CRYPT_SECRETS_TABLE_NAME "secrets"
30 #define CRYPT_SECRETS_CREATE_TABLE \
31 "CREATE TABLE " CRYPT_SECRETS_TABLE_NAME \
32 " (id TEXT NOT NULL, value TEXT, salt TEXT, iv TEXT, " \
34 #define CRYPT_SECRETS_INSERT_INTO \
35 "INSERT INTO " CRYPT_SECRETS_TABLE_NAME " VALUES(@id, @value, @salt, @iv);"
36 #define CRYPT_SECRETS_GET \
37 "SELECT value, salt, iv FROM " CRYPT_SECRETS_TABLE_NAME " WHERE id=?;"
int save_sqlite_store_entry(sqlite3 *db, struct store_row *row)
Save a store entry into the sqlite db.
Definition: sqlite_crypt_writer.c:73
int save_sqlite_secrets_entry(sqlite3 *db, struct secrets_row *row)
Save a secrets entry into the sqlite db.
Definition: sqlite_crypt_writer.c:138
void free_sqlite_crypt_db(sqlite3 *db)
Closes the sqlite db.
Definition: sqlite_crypt_writer.c:67
struct secrets_row * get_sqlite_secrets_row(sqlite3 *db, const char *id)
Get the sqlite secrets entry object.
Definition: sqlite_crypt_writer.c:273
void free_sqlite_secrets_row(struct secrets_row *row)
Frees a secrets row entry.
Definition: sqlite_crypt_writer.c:259
int open_sqlite_crypt_db(const char *db_path, sqlite3 **sql)
Opens the sqlite crypt db.
Definition: sqlite_crypt_writer.c:22
struct store_row * get_sqlite_store_row(sqlite3 *db, const char *key)
Get the sqlite store entry object.
Definition: sqlite_crypt_writer.c:200
void free_sqlite_store_row(struct store_row *row)
Frees a store row entry.
Definition: sqlite_crypt_writer.c:187
The secrets row structure definition.
Definition: sqlite_crypt_writer.h:54
char * salt
Definition: sqlite_crypt_writer.h:57
char * iv
Definition: sqlite_crypt_writer.h:58
char * id
Definition: sqlite_crypt_writer.h:55
char * value
Definition: sqlite_crypt_writer.h:56
The store row structure definition.
Definition: sqlite_crypt_writer.h:43
char * value
Definition: sqlite_crypt_writer.h:45
char * id
Definition: sqlite_crypt_writer.h:46
const char * key
Definition: sqlite_crypt_writer.h:44
char * iv
Definition: sqlite_crypt_writer.h:47