• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

ODc_Crypto.h

Go to the documentation of this file.
00001 /* Copyright (C) 2010 Marc Maurer <uwog@uwog.net>
00002  *
00003  * This program is free software; you can redistribute it and/or
00004  * modify it under the terms of the GNU General Public License
00005  * as published by the Free Software Foundation; either version 2
00006  * of the License, or (at your option) any later version.
00007  *
00008  * This program is distributed in the hope that it will be useful,
00009  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00010  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011  * GNU General Public License for more details.
00012  *
00013  * You should have received a copy of the GNU General Public License
00014  * along with this program; if not, write to the Free Software
00015  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
00016  * 02111-1307, USA.
00017  */
00018 
00019 #ifndef __ODC_CRYPTO__
00020 #define __ODC_CRYPTO__
00021 
00022 #include <string>
00023 #include <gsf/gsf.h>
00024 #include <gsf/gsf-input.h>
00025 #include "ut_types.h"
00026 
00027 class ODc_CryptoInfo {
00028 public:
00029     // stream information
00030     UT_uint32       m_decryptedSize;
00031 
00032     // algorithm information
00033     std::string     m_algorithm;
00034     std::string     m_initVector;
00035 
00036     // key information
00037     std::string     m_keyType;
00038     UT_uint32       m_iterCount;
00039     std::string     m_salt;
00040 };
00041 
00042 class ODc_Crypto {
00043 public:
00044     static UT_Error decrypt(GsfInput* pStream, const ODc_CryptoInfo& cryptInfo,
00045                             const std::string& password, GsfInput** pDecryptedInput);
00046 
00047 private:
00048     static UT_Error performDecrypt(GsfInput* pStream,   unsigned char* salt, UT_uint32 salt_length, UT_uint32 iter_count,
00049                                    unsigned char* ivec, gsize ivec_length, const std::string& password, UT_uint32 decrypted_size, GsfInput** pDecryptedInput);
00050 };
00051 
00052 #endif /* __ODC_CRYPTO__ */

Generated on Sat May 26 2012 for AbiWord by  doxygen 1.7.1