Loading...
Searching...
No Matches
crypto.hpp
Go to the documentation of this file.
//*********************************************************************/
// dar - disk archive - a backup/restoration program
// Copyright (C) 2002-2024 Denis Corbin
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
//
// to contact the author, see the AUTHOR file
/*********************************************************************/
#ifndef CRYPTO_HPP
#define CRYPTO_HPP
extern "C"
{
}
#include "../my_config.h"
#include <string>
#include "datetime.hpp"
#include <list>
namespace libdar
{
enum class crypto_algo
{
none,
scrambling,
blowfish,
aes256,
twofish256,
serpent256,
camellia256
};
struct signator
{
enum result_t
{
good, //< good signature
bad, //< key correct bug signature tempered
unknown_key, //< no key found to check the signature
error //< signature failed to be checked for other error
};
enum key_validity_t
{
valid, //< the key we have is neither expired nor revoked
expired, //< the key we have has expired
revoked //< the key we have has been revoked
};
key_validity_t key_validity; //< validity of the key used to verify the signature
result_t result; //< status of the signing
std::string fingerprint; //< fingerprint of the key
datetime signing_date; //< date of signature
datetime signature_expiration_date; //< date of expiration of this signature
bool operator < (const signator & ref) const { return fingerprint < ref.fingerprint; };
bool operator == (const signator & ref) const { return result == ref.result && key_validity == ref.key_validity && fingerprint == ref.fingerprint && signature_expiration_date == ref.signature_expiration_date; };
};
extern std::string crypto_algo_2_string(crypto_algo algo);
extern char crypto_algo_2_char(crypto_algo a);
extern crypto_algo char_2_crypto_algo(char a);
extern bool same_signatories(const std::list<signator> & a, const std::list<signator> & b);
} // end of namespace
#endif
libdar::datetime
stores time information
Definition datetime.hpp:59
datetime.hpp
this file contains the definition of class datetime that stores unix times in a portable way
libdar::crypto_algo_2_char
char crypto_algo_2_char(crypto_algo a)
convert crypto algo to char
libdar::crypto_algo_2_string
std::string crypto_algo_2_string(crypto_algo algo)
convert crypto algo to readable std::string
libdar::char_2_crypto_algo
crypto_algo char_2_crypto_algo(char a)
convert char to crypto algo
libdar::crypto_algo
crypto_algo
the different cypher available for encryption (strong or weak)
Definition crypto.hpp:50
libdar::same_signatories
bool same_signatories(const std::list< signator > &a, const std::list< signator > &b)
return whether the two signators lists match
libdar::hash_algo::none
@ none
no hashing algorithm
libdar::crypto_algo::camellia256
@ camellia256
camellia 256 strong encryption
libdar::crypto_algo::aes256
@ aes256
AES 256 strong encryption.
libdar::crypto_algo::blowfish
@ blowfish
blowfish strong encryption
libdar::crypto_algo::serpent256
@ serpent256
serpent 256 strong encryption
libdar::crypto_algo::scrambling
@ scrambling
scrambling weak encryption
libdar::crypto_algo::twofish256
@ twofish256
twofish 256 strong encryption
my_config.h
include macro defined by the configure script and some specific additional ones
libdar
libdar namespace encapsulate all libdar symbols
Definition archive.hpp:47
libdar::signator
signator status
Definition crypto.hpp:63