The Battle for Wesnoth  1.15.0+dev
Classes | Namespaces | Macros | Functions | Variables
credentials.cpp File Reference
#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/rc4.h>
Include dependency graph for credentials.cpp:

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 ERR_CFG   LOG_STREAM(err , log_config)
 

Functions

static secure_buffer encrypt (const secure_buffer &text, const secure_buffer &key)
 
static secure_buffer decrypt (const secure_buffer &text, const secure_buffer &key)
 
static secure_buffer build_key (const std::string &server, const std::string &login)
 
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 ()
 
static secure_buffer rc4_crypt (const secure_buffer &text, const secure_buffer &key)
 

Variables

static lg::log_domain log_config ("config")
 
static std::vector< login_infocredentials
 
static const unsigned char CREDENTIAL_SEPARATOR = '\f'
 
static const std::string EMPTY_LOGIN = "@@"
 

Macro Definition Documentation

◆ ERR_CFG

#define ERR_CFG   LOG_STREAM(err , log_config)

Function Documentation

◆ build_key()

secure_buffer build_key ( const std::string &  server,
const std::string &  login 
)
static

◆ clear_credentials()

static void clear_credentials ( )
static

◆ decrypt()

secure_buffer decrypt ( const secure_buffer text,
const secure_buffer key 
)
static

Definition at line 312 of file credentials.cpp.

References rc4_crypt().

Referenced by preferences::load_credentials(), and preferences::password().

◆ encrypt()

secure_buffer encrypt ( const secure_buffer text,
const secure_buffer key 
)
static

Definition at line 307 of file credentials.cpp.

References rc4_crypt().

Referenced by preferences::save_credentials(), and preferences::set_password().

◆ escape()

secure_buffer escape ( const secure_buffer text)
static

Definition at line 346 of file credentials.cpp.

References c.

Referenced by preferences::save_credentials().

◆ get_system_username()

static std::string get_system_username ( )
static

◆ rc4_crypt()

static secure_buffer rc4_crypt ( const secure_buffer text,
const secure_buffer key 
)
static

Definition at line 271 of file credentials.cpp.

References i.

Referenced by decrypt(), and encrypt().

◆ unescape()

secure_buffer unescape ( const secure_buffer text)
static

Definition at line 321 of file credentials.cpp.

References c.

Referenced by preferences::load_credentials().

Variable Documentation

◆ CREDENTIAL_SEPARATOR

const unsigned char CREDENTIAL_SEPARATOR = '\f'
static

Definition at line 72 of file credentials.cpp.

Referenced by preferences::load_credentials(), and preferences::save_credentials().

◆ credentials

std::vector<login_info> credentials
static

Definition at line 69 of file credentials.cpp.

◆ EMPTY_LOGIN

const std::string EMPTY_LOGIN = "@@"
static

Definition at line 110 of file credentials.cpp.

Referenced by preferences::login().

◆ log_config

lg::log_domain log_config("config")
static