Main Page | Class Hierarchy | Compound List | File List | Compound Members | File Members

MCryptPP.h

Go to the documentation of this file.
00001 /*
00002  * steghide 0.5.1 - a steganography program
00003  * Copyright (C) 1999-2003 Stefan Hetzl <shetzl@chello.at>
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  */
00020 
00021 #include "common.h"
00022 
00023 #ifdef USE_LIBMCRYPT
00024 
00025 #ifndef SH_MCRYPTPP_H
00026 #define SH_MCRYPTPP_H
00027 
00028 #include <string>
00029 
00030 #include <mcrypt.h>
00031 
00032 class BitString ;
00033 class EncryptionAlgorithm ;
00034 class EncryptionMode ;
00035 
00036 #ifdef WIN32
00037 #define MCRYPTPP_LIBDIR "./modules/"
00038 #else
00039 #define MCRYPTPP_LIBDIR NULL
00040 #endif
00041 
00042 class MCryptPP {
00043         public:
00044         MCryptPP (void) ;
00045         MCryptPP (EncryptionAlgorithm a, EncryptionMode m) ;
00046 
00047         ~MCryptPP (void) ;
00048 
00054         void open (EncryptionAlgorithm a, EncryptionMode m) ;
00055 
00059         void close (void) ;
00060 
00067         BitString encrypt (BitString p, std::string pp) ;
00068 
00075         BitString decrypt (BitString c, std::string pp) ;
00076 
00077         EncryptionAlgorithm getAlgorithm (void) const ;
00078         EncryptionMode getMode (void) const ;
00079 
00087         static unsigned long getEncryptedSize (EncryptionAlgorithm a, EncryptionMode m, unsigned long plnsize) ;
00088 
00089         static std::vector<std::string> getListModes (void) ;
00090         static std::vector<std::string> getListAlgorithms (void) ;
00091 
00092         static bool AlgoSupportsMode (EncryptionAlgorithm a, EncryptionMode m) ;
00093 
00094         protected:
00095         void *createKey (std::string pp) ;
00096 
00105         std::vector<BYTE> _encrypt (std::vector<unsigned char> p, std::string pp) ;
00106 
00115         std::vector<BYTE> _decrypt (std::vector<unsigned char> c, std::string pp) ;
00116 
00117         private:
00119         bool ModuleOpen ;
00120         MCRYPT MCryptD ;
00121 
00122         void *s_malloc (size_t size) ;
00123 } ;
00124 
00125 #endif // ndef SH_MCRYPTPP_H
00126 
00127 #endif // def USE_LIBMCRYPT

Generated on Thu Nov 13 23:44:21 2003 for steghide by doxygen 1.3.3