forked from sqlitebrowser/sqlitebrowser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCipherSettings.cpp
More file actions
53 lines (43 loc) · 1 KB
/
CipherSettings.cpp
File metadata and controls
53 lines (43 loc) · 1 KB
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
#include "CipherSettings.h"
CipherSettings::CipherSettings()
: keyFormat(Passphrase),
pageSize(0),
kdfIterations(0)
{
}
CipherSettings::KeyFormats CipherSettings::getKeyFormat() const
{
return keyFormat;
}
void CipherSettings::setKeyFormat(const KeyFormats &value)
{
keyFormat = value;
}
QString CipherSettings::getPassword() const
{
if(keyFormat == Passphrase)
{
QString tempPassword = password;
tempPassword.replace("'", "''");
return QString("'%1'").arg(tempPassword);
} else {
// Remove the '0x' part at the beginning
return QString("\"x'%1'\"").arg(password.mid(2));
}
}
void CipherSettings::setPassword(const QString &value)
{
password = value;
}
int CipherSettings::getPageSize() const
{
return pageSize;
}
void CipherSettings::setPageSize(int value)
{
pageSize = value;
}
CipherSettings::KeyFormats CipherSettings::getKeyFormat(int rawKeyFormat)
{
return static_cast<CipherSettings::KeyFormats>(rawKeyFormat);
}