26 #ifndef CRYPTO_SYM_HPP
27 #define CRYPTO_SYM_HPP
32 #ifndef GCRYPT_NO_DEPRECATED
33 #define GCRYPT_NO_DEPRECATED
39 #include "../my_config.h"
53 inline bool crypto_min_ver_libgcrypt_no_bug()
56 return gcry_check_version(MIN_VERSION_GCRYPT_HASH_BUG);
70 bool no_initial_shift,
73 const std::string & salt,
99 const char *clear_buf,
const U_32 clear_size,
const U_32 clear_allocated,
100 char *crypt_buf, U_32 crypt_size)
override;
102 const char *crypt_buf,
const U_32 crypt_size,
103 char *clear_buf, U_32 clear_size)
override;
107 gcry_cipher_hd_t clef;
108 gcry_cipher_hd_t essiv_clef;
122 gcry_cipher_hd_t & IVkey,
132 static void make_ivec(
const infinint & ref,
135 const gcry_cipher_hd_t & IVkey);
139 const std::string & salt,
148 #ifdef LIBDAR_NO_OPTIMIZATION
149 static void self_test(
void);
set of datastructures used to interact with a catalogue object
class archive_version manages the version of the archive format
symetrical strong encryption, interface to grypt library
U_I algo_id
algo ID in libgcrypt
unsigned char * ivec
algo_block_size allocated in secure memory to be used as Initial Vector
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
static std::string generate_salt(U_I size)
generates a random salt of given size
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
this method encrypts the clear data given
virtual U_32 clear_block_allocated_size_for(U_32 clear_block_size) override
it may be necessary by the inherited class have few more bytes allocated after the clear data given f...
size_t algo_block_size
the block size of the algorithm (main key)
virtual U_32 encrypted_block_size_for(U_32 clear_block_size) override
defines the size necessary to encrypt a given amount of clear data
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
this method decyphers data
static size_t max_key_len(crypto_algo algo)
returns the max key length in octets for the given algorithm
this is the interface class from which all other data transfer classes inherit
the arbitrary large positive integer class
this is a partial implementation of the generic_file interface to cypher/decypher data block by block...
infinint block_num
block number we next read or write
U_32 clear_block_size
max amount of data that will be encrypted at once (must stay less than buf_size)
archive_version reading_ver
archive format we currently read
the crypto algoritm definition
hash_algo
hashing algorithm available
crypto_algo
the different cypher available for encryption (strong or weak)
libdar namespace encapsulate all libdar symbols
this file contains the definition of secu_string class, a std::string like class but allocated in sec...
defines a block structured file.