Disk ARchive  2.5.2
Full featured and portable backup and archiving tool
crypto.hpp
Go to the documentation of this file.
00001 //*********************************************************************/
00002 // dar - disk archive - a backup/restoration program
00003 // Copyright (C) 2002-2052 Denis Corbin
00004 //
00005 // This program is free software; you can redistribute it and/or
00006 // modify it under the terms of the GNU General Public License
00007 // as published by the Free Software Foundation; either version 2
00008 // of the License, or (at your option) any later version.
00009 //
00010 // This program is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 // GNU General Public License for more details.
00014 //
00015 // You should have received a copy of the GNU General Public License
00016 // along with this program; if not, write to the Free Software
00017 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00018 //
00019 // to contact the author : http://dar.linux.free.fr/email.html
00020 /*********************************************************************/
00021 
00025 
00026 #ifndef CRYPTO_HPP
00027 #define CRYPTO_HPP
00028 
00029 extern "C"
00030 {
00031 
00032 }
00033 
00034 #include "../my_config.h"
00035 #include <string>
00036 
00037 #include "datetime.hpp"
00038 
00039 #include <list>
00040 
00041 namespace libdar
00042 {
00043 
00046 
00048 
00051     enum crypto_algo
00052     {
00053     crypto_none,          
00054     crypto_scrambling,    
00055     crypto_blowfish,      
00056     crypto_aes256,        
00057     crypto_twofish256,    
00058     crypto_serpent256,    
00059     crypto_camellia256    
00060     };
00061 
00062 
00063     struct signator
00064     {
00065     enum
00066     {
00067         good,         //< good signature
00068         bad,          //< key correct bug signature tempered
00069         unknown_key,  //< no key found to check the signature
00070         error         //< signature failed to be checked for other error
00071     } result;         //< status of the signing
00072     enum
00073     {
00074         valid,        //< the key we have is neither expired nor revoked
00075         expired,      //< the key we have has expired
00076         revoked       //< the key we have has been revoked
00077     } key_validity;   //< validity of the key used to verify the signature
00078     std::string fingerprint; //< fingerprint of the key
00079     datetime signing_date;   //< date of signature
00080     datetime signature_expiration_date; //< date of expiration of this signature
00081     bool operator < (const signator & ref) const { return fingerprint < ref.fingerprint; };
00082     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; };
00083     };
00084 
00085 
00086     extern std::string crypto_algo_2_string(crypto_algo algo);
00087 
00088     extern char crypto_algo_2_char(crypto_algo a);
00089     extern crypto_algo char_2_crypto_algo(char a);
00090 
00091     extern bool same_signatories(const std::list<signator> & a, const std::list<signator> & b);
00092 
00094 
00095 } // end of namespace
00096 
00097 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines