cwist
Modern C web framework with libttak runtime
Loading...
Searching...
No Matches
db_crypt.h
Go to the documentation of this file.
1
26#ifndef __CWIST_DB_CRYPT_H__
27#define __CWIST_DB_CRYPT_H__
28
29#include <stddef.h>
30#include <stdint.h>
31
33#define CWIST_DB_CRYPT_OK 0
34#define CWIST_DB_CRYPT_ERR_ARGS (-1)
35#define CWIST_DB_CRYPT_ERR_CRYPTO (-2)
36#define CWIST_DB_CRYPT_ERR_FORMAT (-3)
37#define CWIST_DB_CRYPT_ERR_MEM (-4)
38
40#define CWIST_DB_CRYPT_KEY_LEN 32
41#define CWIST_DB_CRYPT_IV_LEN 16
43#define CWIST_DB_CRYPT_HDR_LEN 109
44
56
71unsigned char *cwist_db_crypt_seal(const cwist_db_crypt_ctx_t *ctx,
72 const unsigned char *sqlite_bytes, size_t sqlite_len,
73 size_t *out_len);
74
87unsigned char *cwist_db_crypt_open(const cwist_db_crypt_ctx_t *ctx, const unsigned char *blob,
88 size_t blob_len, size_t *out_len);
89
90#endif /* __CWIST_DB_CRYPT_H__ */
unsigned char * cwist_db_crypt_seal(const cwist_db_crypt_ctx_t *ctx, const unsigned char *sqlite_bytes, size_t sqlite_len, size_t *out_len)
Encrypt an SQLite database blob.
Definition db_crypt.c:68
unsigned char * cwist_db_crypt_open(const cwist_db_crypt_ctx_t *ctx, const unsigned char *blob, size_t blob_len, size_t *out_len)
Decrypt a sealed blob produced by cwist_db_crypt_seal().
Definition db_crypt.c:160
#define CWIST_DB_CRYPT_KEY_LEN
Definition db_crypt.h:40
Caller-managed key pair.
Definition db_crypt.h:53
unsigned char kek[CWIST_DB_CRYPT_KEY_LEN]
Definition db_crypt.h:54