steghide  0.5.1
MCryptPP.h
Go to the documentation of this file.
1 /*
2  * steghide 0.5.1 - a steganography program
3  * Copyright (C) 1999-2003 Stefan Hetzl <shetzl@chello.at>
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  */
20 
21 #include "common.h"
22 
23 #ifdef USE_LIBMCRYPT
24 
25 #ifndef SH_MCRYPTPP_H
26 #define SH_MCRYPTPP_H
27 
28 #include <string>
29 
30 #include <mcrypt.h>
31 
32 class BitString ;
33 class EncryptionAlgorithm ;
34 class EncryptionMode ;
35 
36 #ifdef WIN32
37 #define MCRYPTPP_LIBDIR "./modules/"
38 #else
39 #define MCRYPTPP_LIBDIR NULL
40 #endif
41 
42 class MCryptPP {
43  public:
44  MCryptPP (void) ;
45  MCryptPP (EncryptionAlgorithm a, EncryptionMode m) ;
46 
47  ~MCryptPP (void) ;
48 
54  void open (EncryptionAlgorithm a, EncryptionMode m) ;
55 
59  void close (void) ;
60 
67  BitString encrypt (BitString p, std::string pp) ;
68 
75  BitString decrypt (BitString c, std::string pp) ;
76 
77  EncryptionAlgorithm getAlgorithm (void) const ;
78  EncryptionMode getMode (void) const ;
79 
87  static unsigned long getEncryptedSize (EncryptionAlgorithm a, EncryptionMode m, unsigned long plnsize) ;
88 
89  static std::vector<std::string> getListModes (void) ;
90  static std::vector<std::string> getListAlgorithms (void) ;
91 
92  static bool AlgoSupportsMode (EncryptionAlgorithm a, EncryptionMode m) ;
93 
94  protected:
95  void *createKey (std::string pp) ;
96 
105  std::vector<BYTE> _encrypt (std::vector<unsigned char> p, std::string pp) ;
106 
115  std::vector<BYTE> _decrypt (std::vector<unsigned char> c, std::string pp) ;
116 
117  private:
119  bool ModuleOpen ;
120  MCRYPT MCryptD ;
121 
122  void *s_malloc (size_t size) ;
123 } ;
124 
125 #endif // ndef SH_MCRYPTPP_H
126 
127 #endif // def USE_LIBMCRYPT
Definition: EncryptionAlgorithm.h:26
Definition: EncryptionMode.h:26
a string of bits
Definition: BitString.h:42