• 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., 51 Franklin Street, Fifth Floor, Boston, MA
00016  * 02110-1301 USA.
00017  */
00018 
00019 #ifndef __ODC_CRYPTO__
00020 #define __ODC_CRYPTO__
00021 
00022 #include <string>
00023 #include "ut_compiler.h"
00024 ABI_W_NO_CONST_QUAL
00025 #include <gsf/gsf.h>
00026 #include <gsf/gsf-input.h>
00027 ABI_W_POP
00028 #include "ut_types.h"
00029 
00030 class ODc_CryptoInfo {
00031 public:
00032     // stream information
00033     UT_uint32       m_decryptedSize;
00034 
00035     // algorithm information
00036     std::string     m_algorithm;
00037     std::string     m_initVector;
00038 
00039     // key information
00040     std::string     m_keyType;
00041     UT_uint32       m_iterCount;
00042     std::string     m_salt;
00043 };
00044 
00045 class ODc_Crypto {
00046 public:
00047     static UT_Error decrypt(GsfInput* pStream, const ODc_CryptoInfo& cryptInfo,
00048                             const std::string& password, GsfInput** pDecryptedInput);
00049 
00050 private:
00051     static UT_Error performDecrypt(GsfInput* pStream,   unsigned char* salt, UT_uint32 salt_length, UT_uint32 iter_count,
00052                                    unsigned char* ivec, gsize ivec_length, const std::string& password, UT_uint32 decrypted_size, GsfInput** pDecryptedInput);
00053 };
00054 
00055 #endif /* __ODC_CRYPTO__ */

Generated on Sun Feb 14 2021 for AbiWord by  doxygen 1.7.1