Luanti 5.10.0-dev
 
Loading...
Searching...
No Matches
auth.cpp File Reference
#include <algorithm>
#include <string>
#include "auth.h"
#include "base64.h"
#include "sha1.h"
#include "srp.h"
#include "util/string.h"
#include "debug.h"
+ Include dependency graph for auth.cpp:

Functions

std::string translate_password (const std::string &name, const std::string &password)
 Gets the base64 encoded legacy password db entry.
 
static void gen_srp_v (const std::string &name, const std::string &password, char **salt, size_t *salt_len, char **bytes_v, size_t *len_v)
 
std::string generate_srp_verifier (const std::string &name, const std::string &password, const std::string &salt)
 Creates a verification key with given salt and password.
 
void generate_srp_verifier_and_salt (const std::string &name, const std::string &password, std::string *verifier, std::string *salt)
 Creates a verification key and salt with given password.
 
std::string get_encoded_srp_verifier (const std::string &name, const std::string &password)
 Gets an SRP verifier, generating a salt, and encodes it as DB-ready string.
 
std::string encode_srp_verifier (const std::string &verifier, const std::string &salt)
 Converts the passed SRP verifier into a DB-ready format.
 
bool decode_srp_verifier_and_salt (const std::string &encoded, std::string *verifier, std::string *salt)
 Reads the DB-formatted SRP verifier and gets the verifier and salt components.
 

Function Documentation

◆ decode_srp_verifier_and_salt()

bool decode_srp_verifier_and_salt ( const std::string & encoded,
std::string * verifier,
std::string * salt )

Reads the DB-formatted SRP verifier and gets the verifier and salt components.

References base64_decode(), base64_is_valid(), and str_split().

Referenced by Server::handleCommand_SrpBytesA(), and ModApiUtil::l_check_password_entry().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ encode_srp_verifier()

std::string encode_srp_verifier ( const std::string & verifier,
const std::string & salt )

Converts the passed SRP verifier into a DB-ready format.

References base64_encode().

Referenced by get_encoded_srp_verifier(), and Server::handleCommand_FirstSrp().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gen_srp_v()

static void gen_srp_v ( const std::string & name,
const std::string & password,
char ** salt,
size_t * salt_len,
char ** bytes_v,
size_t * len_v )
inlinestatic

References FATAL_ERROR_IF, lowercase(), srp_create_salted_verification_key(), SRP_NG_2048, SRP_OK, and SRP_SHA256.

Referenced by generate_srp_verifier(), and generate_srp_verifier_and_salt().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ generate_srp_verifier()

std::string generate_srp_verifier ( const std::string & name,
const std::string & password,
const std::string & salt )

Creates a verification key with given salt and password.

References gen_srp_v().

Referenced by ModApiUtil::l_check_password_entry().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ generate_srp_verifier_and_salt()

void generate_srp_verifier_and_salt ( const std::string & name,
const std::string & password,
std::string * verifier,
std::string * salt )

Creates a verification key and salt with given password.

References gen_srp_v().

Referenced by get_encoded_srp_verifier(), Server::handleCommand_SrpBytesA(), and Client::startAuth().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ get_encoded_srp_verifier()

std::string get_encoded_srp_verifier ( const std::string & name,
const std::string & password )

Gets an SRP verifier, generating a salt, and encodes it as DB-ready string.

References encode_srp_verifier(), and generate_srp_verifier_and_salt().

Referenced by Server::handleCommand_Init().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ translate_password()

std::string translate_password ( const std::string & name,
const std::string & password )

Gets the base64 encoded legacy password db entry.

References SHA1::addBytes(), base64_encode(), and SHA1::getDigest().

Referenced by ModApiUtil::l_check_password_entry(), ModApiUtil::l_get_password_hash(), and Client::startAuth().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: