LCOV - code coverage report
Current view: top level - include/oox/crypto - AgileEngine.hxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 0 2 0.0 %
Date: 2015-06-13 12:38:46 Functions: 0 3 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2             : /*
       3             :  * This file is part of the LibreOffice project.
       4             :  *
       5             :  * This Source Code Form is subject to the terms of the Mozilla Public
       6             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       7             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
       8             :  *
       9             :  */
      10             : 
      11             : #ifndef INCLUDED_OOX_CRYPTO_AGILEENGINE_HXX
      12             : #define INCLUDED_OOX_CRYPTO_AGILEENGINE_HXX
      13             : 
      14             : #include <oox/crypto/CryptTools.hxx>
      15             : #include <oox/crypto/CryptoEngine.hxx>
      16             : 
      17             : namespace oox {
      18             : namespace core {
      19             : 
      20             : const sal_uInt32 SEGMENT_LENGTH = 4096;
      21             : 
      22           0 : struct AgileEncryptionInfo
      23             : {
      24             :     sal_Int32               spinCount;
      25             :     sal_Int32               saltSize;
      26             :     sal_Int32               keyBits;
      27             :     sal_Int32               hashSize;
      28             :     sal_Int32               blockSize;
      29             : 
      30             :     OUString cipherAlgorithm;
      31             :     OUString cipherChaining;
      32             :     OUString hashAlgorithm;
      33             : 
      34             :     std::vector<sal_uInt8>  keyDataSalt;
      35             :     std::vector<sal_uInt8>  saltValue;
      36             :     std::vector<sal_uInt8>  encryptedVerifierHashInput;
      37             :     std::vector<sal_uInt8>  encryptedVerifierHashValue;
      38             :     std::vector<sal_uInt8>  encryptedKeyValue;
      39             : };
      40             : 
      41             : class AgileEngine : public CryptoEngine
      42             : {
      43             :     AgileEncryptionInfo mInfo;
      44             : 
      45             :     bool calculateHashFinal(const OUString& rPassword, std::vector<sal_uInt8>& aHashFinal);
      46             : 
      47             :     bool calculateBlock(
      48             :             const sal_uInt8* rBlock,
      49             :             sal_uInt32 aBlockSize,
      50             :             std::vector<sal_uInt8>& rHashFinal,
      51             :             std::vector<sal_uInt8>& rInput,
      52             :             std::vector<sal_uInt8>& rOutput);
      53             : 
      54             :     static Crypto::CryptoType cryptoType(const AgileEncryptionInfo& rInfo);
      55             : 
      56             : public:
      57             :     AgileEngine();
      58             :     virtual ~AgileEngine();
      59             : 
      60           0 :     AgileEncryptionInfo& getInfo() { return mInfo;}
      61             : 
      62             :     virtual bool writeEncryptionInfo(
      63             :                     const OUString& rPassword,
      64             :                     BinaryXOutputStream& rStream) SAL_OVERRIDE;
      65             : 
      66             :     virtual bool generateEncryptionKey(const OUString& rPassword) SAL_OVERRIDE;
      67             : 
      68             :     virtual bool decrypt(
      69             :                     BinaryXInputStream& aInputStream,
      70             :                     BinaryXOutputStream& aOutputStream) SAL_OVERRIDE;
      71             : 
      72             :     virtual bool encrypt(
      73             :                     BinaryXInputStream& aInputStream,
      74             :                     BinaryXOutputStream& aOutputStream) SAL_OVERRIDE;
      75             : };
      76             : 
      77             : } // namespace core
      78             : } // namespace oox
      79             : 
      80             : #endif
      81             : 
      82             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11