libfilezilla
Public Types | Public Member Functions | Static Public Member Functions | List of all members
symmetric_key Class Reference

Symmetric encryption key with associated salt. More...

#include <encryption.hpp>

Public Types

enum  { key_size = 32 , salt_size = 32 }
 Size in octets of key an salt.
 
enum  { min_iterations = 100000 }
 

Public Member Functions

 operator bool () const
 
std::vector< uint8_t > const & salt () const
 
std::string to_base64 (bool pad=true) const
 
std::vector< uint8_t > encrypt_key (fz::public_key const &kek)
 
std::vector< uint8_t > const & key () const
 

Static Public Member Functions

static symmetric_key generate ()
 Generates a random symmetric key.
 
static symmetric_key from_password (std::vector< uint8_t > const &password, std::vector< uint8_t > const &salt, unsigned int iterations=min_iterations)
 Derives a symmetric key using PBKDF2-SHA256 from the given password and salt. More...
 
static symmetric_key from_password (std::string_view const &password, std::vector< uint8_t > const &salt, unsigned int iterations=min_iterations)
 
static symmetric_key from_base64 (std::string_view const &base64)
 
static symmetric_key from_base64 (std::wstring_view const &base64)
 
static symmetric_key decrypt_key (std::vector< uint8_t > const &encrypted, fz::private_key const &kek)
 
static size_t encryption_overhead ()
 

Detailed Description

Symmetric encryption key with associated salt.

Member Function Documentation

◆ from_password()

static symmetric_key from_password ( std::vector< uint8_t > const &  password,
std::vector< uint8_t > const &  salt,
unsigned int  iterations = min_iterations 
)
static

Derives a symmetric key using PBKDF2-SHA256 from the given password and salt.

Parameters
iterationscannot be smaller than min_iterations

The documentation for this class was generated from the following file: