-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathsqlite3mc.h
executable file
·125 lines (105 loc) · 3.25 KB
/
sqlite3mc.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
/*
** Name: sqlite3mc.h
** Purpose: Header file for SQLite3 Multiple Ciphers support
** Author: Ulrich Telle
** Created: 2020-03-01
** Copyright: (c) 2019-2021 Ulrich Telle
** License: MIT
*/
#ifndef SQLITE3MC_H_
#define SQLITE3MC_H_
/*
** Define SQLite3 Multiple Ciphers version information
*/
#include "wxsqlite3/sqlite3mc_version.h"
/*
** Define SQLite3 API
*/
#include "wxsqlite3/sqlite3.h"
#ifdef SQLITE_USER_AUTHENTICATION
#include "wxsqlite3/sqlite3userauth.h"
#endif
/*
** Symbols for ciphers
*/
#define CODEC_TYPE_UNKNOWN 0
#define CODEC_TYPE_AES128 1
#define CODEC_TYPE_AES256 2
#define CODEC_TYPE_CHACHA20 3
#define CODEC_TYPE_SQLCIPHER 4
#define CODEC_TYPE_RC4 5
#define CODEC_TYPE_MAX 5
/*
** Definition of API functions
*/
/*
** Define Windows specific SQLite API functions (not defined in sqlite3.h)
*/
#if SQLITE_OS_WIN == 1
#ifdef __cplusplus
extern "C" {
#endif
SQLITE_API int sqlite3_win32_set_directory(unsigned long type, void* zValue);
#ifdef __cplusplus
}
#endif
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*
** Specify the key for an encrypted database.
** This routine should be called right after sqlite3_open().
**
** Arguments:
** db - Database to be encrypted
** zDbName - Name of the database (e.g. "main")
** pKey - Passphrase
** nKey - Length of passphrase
*/
SQLITE_API int sqlite3_key(sqlite3* db, const void* pKey, int nKey);
SQLITE_API int sqlite3_key_v2(sqlite3* db, const char* zDbName, const void* pKey, int nKey);
/*
** Change the key on an open database.
** If the current database is not encrypted, this routine will encrypt
** it. If pNew==0 or nNew==0, the database is decrypted.
**
** Arguments:
** db - Database to be encrypted
** zDbName - Name of the database (e.g. "main")
** pKey - Passphrase
** nKey - Length of passphrase
*/
SQLITE_API int sqlite3_rekey(sqlite3* db, const void* pKey, int nKey);
SQLITE_API int sqlite3_rekey_v2(sqlite3* db, const char* zDbName, const void* pKey, int nKey);
/*
** Specify the activation key for a SEE database.
** Unless activated, none of the SEE routines will work.
**
** Arguments:
** zPassPhrase - Activation phrase
**
** Note: Provided only for API compatibility with SEE.
** Encryption support of SQLite3 Multi Cipher is always enabled.
*/
SQLITE_API void sqlite3_activate_see(const char* zPassPhrase);
/*
** Define functions for the configuration of the wxSQLite3 encryption extension
*/
SQLITE_API int sqlite3mc_config(sqlite3* db, const char* paramName, int newValue);
SQLITE_API int sqlite3mc_config_cipher(sqlite3* db, const char* cipherName, const char* paramName, int newValue);
SQLITE_API unsigned char* sqlite3mc_codec_data(sqlite3* db, const char* zDbName, const char* paramName);
SQLITE_API const char* sqlite3mc_version();
#ifdef SQLITE3MC_WXSQLITE3_COMPATIBLE
SQLITE_API int wxsqlite3_config(sqlite3* db, const char* paramName, int newValue);
SQLITE_API int wxsqlite3_config_cipher(sqlite3* db, const char* cipherName, const char* paramName, int newValue);
SQLITE_API unsigned char* wxsqlite3_codec_data(sqlite3* db, const char* zDbName, const char* paramName);
#endif
#ifdef __cplusplus
}
#endif
/*
** Define public SQLite3 Multiple Ciphers VFS interface
*/
#include "wxsqlite3/sqlite3mc_vfs.h"
#endif