diff options
Diffstat (limited to 'src/wrap')
-rw-r--r-- | src/wrap/sqlite/codec.cpp | 8 | ||||
-rw-r--r-- | src/wrap/sqlite/codec.h | 8 |
2 files changed, 8 insertions, 8 deletions
diff --git a/src/wrap/sqlite/codec.cpp b/src/wrap/sqlite/codec.cpp index 5dfcea82e..60c8f6a21 100644 --- a/src/wrap/sqlite/codec.cpp +++ b/src/wrap/sqlite/codec.cpp @@ -54,12 +54,12 @@ Codec::InitializeCodec(void *db) void Codec::GenerateWriteKey(const char* userPassword, int passwordLength) { - S2K* s2k = get_s2k(S2K_STR); - s2k->set_iterations(S2K_ITERATIONS); - s2k->change_salt((const byte*)SALT_STR.c_str(), SALT_SIZE); + PBKDF* pbkdf = get_pbkdf(PBKDF_STR); + pbkdf->set_iterations(PBKDF_ITERATIONS); + pbkdf->change_salt((const byte*)SALT_STR.c_str(), SALT_SIZE); SymmetricKey masterKey = - s2k->derive_key(KEY_SIZE + IV_DERIVATION_KEY_SIZE, std::string(userPassword, passwordLength)); + pbkdf->derive_key(KEY_SIZE + IV_DERIVATION_KEY_SIZE, std::string(userPassword, passwordLength)); m_writeKey = SymmetricKey(masterKey.bits_of(), KEY_SIZE); m_ivWriteKey = SymmetricKey(masterKey.bits_of() + KEY_SIZE, IV_DERIVATION_KEY_SIZE); diff --git a/src/wrap/sqlite/codec.h b/src/wrap/sqlite/codec.h index 8b753be62..c254f9fde 100644 --- a/src/wrap/sqlite/codec.h +++ b/src/wrap/sqlite/codec.h @@ -50,9 +50,9 @@ using namespace Botan; //make sure to add "/NoPadding" for modes that use padding schemes const string BLOCK_CIPHER_STR = "Twofish/XTS"; -//S2K_STR: Key derivation function used to derive both the encryption +//PBKDF_STR: Key derivation function used to derive both the encryption //and IV derivation keys from the given database passphrase -const string S2K_STR = "PBKDF2(SHA-160)"; +const string PBKDF_STR = "PBKDF2(SHA-160)"; //SALT_STR: Hard coded salt used to derive the key from the passphrase. const string SALT_STR = "&g#nB'9]"; @@ -61,9 +61,9 @@ const string SALT_STR = "&g#nB'9]"; //encryption const string MAC_STR = "CMAC(Twofish)"; -//S2K_ITERATIONS: Number of hash iterations used in the key derivation +//PBKDF_ITERATIONS: Number of hash iterations used in the key derivation //process. -const int S2K_ITERATIONS = 10000; +const int PBKDF_ITERATIONS = 10000; //SALT_SIZE: Size of the salt in bytes (as given in SALT_STR) const int SALT_SIZE = 64/8; //64 bit, 8 byte salt |