Disk ARchive: crypto.hpp Source File

| Disk ARchive 2.8.3 Full featured and portable backup and archiving tool

Loading...
Searching...
No Matches
crypto.hpp
Go to the documentation of this file.
1//*********************************************************************/
2// dar - disk archive - a backup/restoration program
3// Copyright (C) 2002-2026 Denis Corbin
4//
5// This program is free software; you can redistribute it and/or
6// modify it under the terms of the GNU General Public License
7// as published by the Free Software Foundation; either version 2
8// of the License, or (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// You should have received a copy of the GNU General Public License
16// along with this program; if not, write to the Free Software
17// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18//
19// to contact the author, see the AUTHOR file
20/*********************************************************************/
21
25
26#ifndef CRYPTO_HPP
27#define CRYPTO_HPP
28
29extern "C"
30{
31
32}
33
34#include "../my_config.h"
35#include <string>
36
37#include "datetime.hpp"
38
39#include <list>
40
41namespace libdar
42{
43
46
48
49 enum class crypto_algo
50 {
51 none,
52 scrambling,
53 blowfish,
54 aes256,
55 twofish256,
56 serpent256,
57 camellia256
58 };
59
61
62 struct signator
63 {
64 enum result_t
65 {
66 good,
67 bad,
68 unknown_key,
69 error
70 };
71 enum key_validity_t
72 {
73 valid,
74 expired,
75 revoked
76 };
77 key_validity_t key_validity;
78 result_t result;
79 std::string fingerprint;
80 datetime signing_date;
81 datetime signature_expiration_date;
82 bool operator < (const signator & ref) const { return fingerprint < ref.fingerprint; };
83 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; };
84 };
85
87 extern std::string crypto_algo_2_string(crypto_algo algo);
88
90 extern char crypto_algo_2_char(crypto_algo a);
91
93 extern crypto_algo char_2_crypto_algo(char a);
94
95
97 extern bool same_signatories(const std::list<signator> & a, const std::list<signator> & b);
98
100
101} // end of namespace
102
103#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
Definition archive_aux.hpp:64
libdar::crypto_algo::camellia256
@ camellia256
camellia 256 strong encryption
Definition crypto.hpp:57
libdar::crypto_algo::aes256
@ aes256
AES 256 strong encryption.
Definition crypto.hpp:54
libdar::crypto_algo::blowfish
@ blowfish
blowfish strong encryption
Definition crypto.hpp:53
libdar::crypto_algo::serpent256
@ serpent256
serpent 256 strong encryption
Definition crypto.hpp:56
libdar::crypto_algo::scrambling
@ scrambling
scrambling weak encryption
Definition crypto.hpp:52
libdar::crypto_algo::twofish256
@ twofish256
twofish 256 strong encryption
Definition crypto.hpp:55
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
libdar::signator::result
result_t result
status of the signing
Definition crypto.hpp:78
libdar::signator::key_validity_t
key_validity_t
Definition crypto.hpp:72
libdar::signator::revoked
@ revoked
the key we have has been revoked
Definition crypto.hpp:75
libdar::signator::expired
@ expired
the key we have has expired
Definition crypto.hpp:74
libdar::signator::valid
@ valid
the key we have is neither expired nor revoked
Definition crypto.hpp:73
libdar::signator::key_validity
key_validity_t key_validity
validity of the key used to verify the signature
Definition crypto.hpp:77
libdar::signator::signing_date
datetime signing_date
date of signature
Definition crypto.hpp:80
libdar::signator::fingerprint
std::string fingerprint
fingerprint of the key
Definition crypto.hpp:79
libdar::signator::result_t
result_t
Definition crypto.hpp:65
libdar::signator::good
@ good
good signature
Definition crypto.hpp:66
libdar::signator::bad
@ bad
key correct bug signature tempered
Definition crypto.hpp:67
libdar::signator::error
@ error
signature failed to be checked for other error
Definition crypto.hpp:69
libdar::signator::unknown_key
@ unknown_key
no key found to check the signature
Definition crypto.hpp:68
libdar::signator::signature_expiration_date
datetime signature_expiration_date
date of expiration of this signature
Definition crypto.hpp:81