#include "credentials.hpp"
#include "preferences/general.hpp"
#include "serialization/unicode.hpp"
#include "filesystem.hpp"
#include "log.hpp"
#include "serialization/string_utils.hpp"
#include <boost/algorithm/string.hpp>
#include <algorithm>
#include <memory>
#include <openssl/evp.h>
#include <openssl/err.h>
Go to the source code of this file.
Classes | |
class | secure_buffer |
struct | login_info |
Namespaces | |
preferences | |
Modify, read and display user preferences. | |
Macros | |
#define | DBG_CFG LOG_STREAM(debug , log_config) |
#define | ERR_CFG LOG_STREAM(err , log_config) |
Functions | |
static secure_buffer | aes_encrypt (const secure_buffer &plaintext, const secure_buffer &key) |
Encrypts the value of plaintext using key and a hard coded IV using AES. More... | |
static secure_buffer | aes_decrypt (const secure_buffer &encrypted, const secure_buffer &key) |
Same as aes_encrypt(), except of course it takes encrypted data as an argument and returns decrypted data. More... | |
static secure_buffer | build_key (const std::string &server, const std::string &login) |
Fills a secure_buffer with 32 bytes of deterministically generated bytes, then overwrites it with the system login name, server login name, and server name. More... | |
static secure_buffer | escape (const secure_buffer &text) |
static secure_buffer | unescape (const secure_buffer &text) |
static std::string | get_system_username () |
static void | clear_credentials () |
std::string | preferences::login () |
void | preferences::set_login (const std::string &login) |
bool | preferences::remember_password () |
void | preferences::set_remember_password (bool remember) |
std::string | preferences::password (const std::string &server, const std::string &login) |
void | preferences::set_password (const std::string &server, const std::string &login, const std::string &key) |
void | preferences::load_credentials () |
void | preferences::save_credentials () |
Variables | |
static lg::log_domain | log_config ("config") |
static std::vector< login_info > | credentials |
static const unsigned char | CREDENTIAL_SEPARATOR = '\f' |
static const std::string | EMPTY_LOGIN = "@@" |
#define DBG_CFG LOG_STREAM(debug , log_config) |
Definition at line 41 of file credentials.cpp.
#define ERR_CFG LOG_STREAM(err , log_config) |
Definition at line 42 of file credentials.cpp.
|
static |
Same as aes_encrypt(), except of course it takes encrypted data as an argument and returns decrypted data.
Definition at line 379 of file credentials.cpp.
References DBG_CFG, ERR_CFG, i, and utils::join().
Referenced by preferences::load_credentials(), and preferences::password().
|
static |
Encrypts the value of plaintext using key and a hard coded IV using AES.
Max size of plaintext must not be larger than 1008 bytes.
NOTE: This is not meant to provide strong protections against a determined attacker. This is meant to hide the passwords from malware scanning files for passwords, family/friends poking around, etc.
plaintext | The original unencrypted data. |
key | The value to use to encrypt the data. See build_key() for key generation. |
Definition at line 288 of file credentials.cpp.
References DBG_CFG, ERR_CFG, i, and utils::join().
Referenced by preferences::save_credentials(), and preferences::set_password().
|
static |
Fills a secure_buffer with 32 bytes of deterministically generated bytes, then overwrites it with the system login name, server login name, and server name.
If this is more than 32 bytes, then it's truncated. If it's less than 32 bytes, then the pre-generated bytes are used to pad it.
server | The server being logged into. |
login | The username being used to login. |
Definition at line 265 of file credentials.cpp.
References get_system_username(), i, and preferences::login().
Referenced by preferences::load_credentials(), preferences::password(), preferences::save_credentials(), and preferences::set_password().
|
static |
Definition at line 102 of file credentials.cpp.
References credentials, and draw::fill().
Referenced by preferences::load_credentials(), preferences::set_password(), and preferences::set_remember_password().
|
static |
Definition at line 497 of file credentials.cpp.
References c.
Referenced by preferences::save_credentials().
|
static |
Definition at line 83 of file credentials.cpp.
References preferences::login(), and utf8::size().
Referenced by build_key(), preferences::load_credentials(), preferences::login(), and preferences::save_credentials().
|
static |
Definition at line 472 of file credentials.cpp.
References c.
Referenced by preferences::load_credentials().
|
static |
Definition at line 75 of file credentials.cpp.
Referenced by preferences::load_credentials(), and preferences::save_credentials().
|
static |
Definition at line 72 of file credentials.cpp.
Referenced by clear_credentials(), preferences::load_credentials(), preferences::password(), preferences::save_credentials(), and preferences::set_password().
|
static |
Definition at line 113 of file credentials.cpp.
Referenced by preferences::login().
|
static |