Disk ARchive  2.7.14
Full featured and portable backup and archiving tool
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
libdar::crypto_sym Class Reference

symetrical strong encryption, interface to grypt library More...

#include <crypto_sym.hpp>

Inherits libdar::crypto_module.

+ Collaboration diagram for libdar::crypto_sym:

Public Member Functions

 crypto_sym (const secu_string &password, const archive_version &reading_ver, crypto_algo algo, const std::string &salt, const infinint &iteration_count, hash_algo kdf_hash, bool use_pkcs5)
 
 crypto_sym (const crypto_sym &ref)
 
 crypto_sym (crypto_sym &&ref) noexcept
 
crypto_symoperator= (const crypto_sym &ref)
 
crypto_symoperator= (crypto_sym &&ref) noexcept
 
virtual U_32 encrypted_block_size_for (U_32 clear_block_size) override
 
virtual U_32 clear_block_allocated_size_for (U_32 clear_block_size) override
 
virtual U_32 encrypt_data (const infinint &block_num, const char *clear_buf, const U_32 clear_size, const U_32 clear_allocated, char *crypt_buf, U_32 crypt_size) override
 
virtual U_32 decrypt_data (const infinint &block_num, const char *crypt_buf, const U_32 crypt_size, char *clear_buf, U_32 clear_size) override
 
virtual std::unique_ptr< crypto_module > clone () const override
 
const std::string & get_salt () const
 give access to the calculated or provided salt
 

Static Public Member Functions

static size_t max_key_len (crypto_algo algo)
 returns the max key length in octets for the given algorithm
 
static size_t max_key_len_libdar (crypto_algo algo)
 returns the max key length in octets to use to compute a key from a user provided password
 
static bool is_a_strong_password (crypto_algo algo, const secu_string &password)
 check whether the given password is reported as strong in regard to the given cipher
 

Private Member Functions

void detruit ()
 
void copy_from (const crypto_sym &ref)
 
void move_from (crypto_sym &&ref)
 

Private Attributes

std::string sel
 the salt
 

Detailed Description

symetrical strong encryption, interface to grypt library

Definition at line 66 of file crypto_sym.hpp.

Constructor & Destructor Documentation

◆ crypto_sym()

libdar::crypto_sym::crypto_sym ( const secu_string password,
const archive_version reading_ver,
crypto_algo  algo,
const std::string &  salt,
const infinint iteration_count,
hash_algo  kdf_hash,
bool  use_pkcs5 
)
Parameters
passwordcipher password
reading_verarchive format version
algociphering algorithm to use
saltif set empty, the salt is generated by the crypto_sym when use_pkcs5 is set to true, else it is not used
iteration_countnot used if use_pkcs5 is not set
kdf_hashnot used if use_pkcs5 is not set
use_pkcs5must be set to true when password is human defined to add a key derivation

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