java.lang.Object | |
↳ | com.tencent.wcdb.database.SQLiteCipherSpec |
Describes encryption options for SQLite databases.
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
String | CIPHER_AES256CBC | 256-bit AES encryption, CBC mode. |
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
public String | cipher | Encryption method used, null for default method, which is 256-bit AES in CBC mode. | |||||||||
public boolean | hmacEnabled | Whether HMAC should be used. | |||||||||
public int | kdfIteration | KDF iteration times to generate encryption keys, 0 for default value. | |||||||||
public int | pageSize | Page size to use. |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
SQLiteCipherSpec()
Create a new object with default values.
| |||||||||||
SQLiteCipherSpec(SQLiteCipherSpec rhs)
Create a new object as a copy of an existed one.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
SQLiteCipherSpec |
setCipher(String c)
Set encryption method to be used.
| ||||||||||
SQLiteCipherSpec |
setKDFIteration(int iter)
Set KDF iteration times to be used.
| ||||||||||
SQLiteCipherSpec |
setPageSize(int size)
Set the page size to use.
| ||||||||||
SQLiteCipherSpec |
setSQLCipherVersion(int version)
Set SQLCipher version compatibility.
| ||||||||||
SQLiteCipherSpec |
withHMACEnabled(boolean enabled)
Set whether to use HMAC in encryption.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
256-bit AES encryption, CBC mode.
Encryption method used, null for default method, which is 256-bit AES in CBC mode.
Whether HMAC should be used.
Defaulted to false
for SQLCipher 1.x, and true
otherwise.
Must be set to the same value as when the database is created, or the database
cannot be opened and SQLiteException
is thrown.
KDF iteration times to generate encryption keys, 0 for default value.
Typical values are 4000 for SQLCipher version 1.x and 2.x, 64000 for version 3.x. For databases created by WCDB itself, leave it 0.
Page size to use.
Page size must be set to the same value as when the database is created, in order to
open existing encrypted database. For databases created by WCDB itself, leave it to
the default is preferred for most applications. If database cannot be opened and
SQLiteException
is thrown, try setting it to 1024 or 4096.
Create a new object with default values.
Create a new object as a copy of an existed one.
rhs | The object to be copied |
---|
Set encryption method to be used.
c | The method name to be used |
---|
Set KDF iteration times to be used.
iter | New iteration times value |
---|
Set the page size to use. The page size should be a power of two.
size | Page size in byte |
---|
Set SQLCipher version compatibility. The version should be 1, 2 or 3 which represent SQLCipher 1.x, 2.x or 3.x. This method overwrites HMAC and KDF iteration settings.
version | SQLCipher version, should be 1, 2 or 3 |
---|
Set whether to use HMAC in encryption. Default to true.
enabled | Whether to use HMAC |
---|