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

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

crypto_asym.hpp
Go to the documentation of this file.
1 //*********************************************************************/
2 // dar - disk archive - a backup/restoration program
3 // Copyright (C) 2002-2052 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 //
19 // to contact the author : http://dar.linux.free.fr/email.html
20 /*********************************************************************/
21
25
26 #ifndef CRYPTO_ASYM_HPP
27 #define CRYPTO_ASYM_HPP
28
29 extern "C"
30 {
31 #if HAVE_GPGME_H
32 #include <gpgme.h>
33 #endif
34 }
35
36 #include "../my_config.h"
37 #include "generic_file.hpp"
38 #include "generic_file_overlay_for_gpgme.hpp"
39 #include "erreurs.hpp"
40 #include "mem_ui.hpp"
41 #include "crypto.hpp"
42
43 #include <list>
44
45 namespace libdar
46 {
49
50 class crypto_asym : public mem_ui
51 {
52 public:
53
55 crypto_asym(const user_interaction & ui) : mem_ui(ui) { build_context(); has_signatories = false; };
56
58 ~crypto_asym() { release_context(); };
59
61 crypto_asym(const crypto_asym & ref): mem_ui(ref) { throw SRC_BUG; };
62
64 const crypto_asym & operator = (const crypto_asym & ref) { throw SRC_BUG; };
65
67 void set_signatories(const std::vector<std::string> & signatories);
68
75 void encrypt(const std::vector<std::string> & recipients_email, generic_file & clear, generic_file & ciphered);
76
82 void decrypt(generic_file & ciphered, generic_file & clear);
83
86 const std::list<signator> & verify() const { return signing_result; };
87
89 user_interaction & get_ui() const { return mem_ui::get_ui(); };
90
91 private:
92 bool has_signatories;
93 std::list<signator> signing_result;
94 #if GPGME_SUPPORT
95 gpgme_ctx_t context; //< GPGME context
96
97 void release_context() { gpgme_release(context); };
98 void build_key_list(const std::vector<std::string> & recipients_email, //< list of email to find a key for
99 gpgme_key_t * & ciphering_keys, //< resulting nullptr terminated list of keys
100 bool signatories); //< false if email key need encryption capability, true for signing
101 void release_key_list(gpgme_key_t * & ciphering_keys);
102 void fill_signing_result();
103 #else
104 void release_context() {};
105 #endif
106
107 void build_context();
108 };
109
111
112 } // end of namespace
113
114 #endif
mem_ui.hpp
class mem_ui definition. This class is to be used as parent class to handle user_interaction object m...
libdar::crypto_asym::verify
const std::list< signator > & verify() const
Definition: crypto_asym.hpp:86
generic_file_overlay_for_gpgme.hpp
adaptation class from gpgme data buffer to libdar generic_file interface
libdar::crypto_asym::~crypto_asym
~crypto_asym()
the destructor
Definition: crypto_asym.hpp:58
generic_file.hpp
class generic_file is defined here as well as class fichierthe generic_file interface is widely used ...
libdar::crypto_asym
Definition: crypto_asym.hpp:50
libdar::user_interaction
This is a pure virtual class that is used by libdar when interaction with the user is required...
Definition: user_interaction.hpp:98
crypto.hpp
the crypto algoritm definition
libdar::crypto_asym::set_signatories
void set_signatories(const std::vector< std::string > &signatories)
defines the list of email which associated key will be used for signing
libdar::crypto_asym::get_ui
user_interaction & get_ui() const
exposing to public visibility the protected method of mem_ui
Definition: crypto_asym.hpp:89
libdar::crypto_asym::encrypt
void encrypt(const std::vector< std::string > &recipients_email, generic_file &clear, generic_file &ciphered)
erreurs.hpp
contains all the excetion class thrown by libdar
libdar::crypto_asym::decrypt
void decrypt(generic_file &ciphered, generic_file &clear)
libdar::crypto_asym::crypto_asym
crypto_asym(const user_interaction &ui)
general use constructor
Definition: crypto_asym.hpp:55
libdar::generic_file
this is the interface class from which all other data transfer classes inherit
Definition: generic_file.hpp:100
libdar::mem_ui
class mem_ui to keep a copy of a user_interaction object
Definition: mem_ui.hpp:53
libdar::crypto_asym::crypto_asym
crypto_asym(const crypto_asym &ref)
disabling copy constructor
Definition: crypto_asym.hpp:61
libdar::mem_ui::get_ui
user_interaction & get_ui() const
get access to the user_interaction cloned object
libdar::crypto_asym::operator=
const crypto_asym & operator=(const crypto_asym &ref)
disabling object assignment
Definition: crypto_asym.hpp:64
libdar
libdar namespace encapsulate all libdar symbols
Definition: archive.hpp:47