1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
11 #ifndef INCLUDED_OOX_CRYPTO_AGILEENGINE_HXX
12 #define INCLUDED_OOX_CRYPTO_AGILEENGINE_HXX
16 #include <oox/crypto/CryptTools.hxx>
17 #include <oox/crypto/CryptoEngine.hxx>
18 #include <rtl/ustring.hxx>
19 #include <sal/types.h>
22 class BinaryXInputStream
;
23 class BinaryXOutputStream
;
29 const sal_uInt32 SEGMENT_LENGTH
= 4096;
31 struct AgileEncryptionInfo
39 OUString cipherAlgorithm
;
40 OUString cipherChaining
;
41 OUString hashAlgorithm
;
43 std::vector
<sal_uInt8
> keyDataSalt
;
44 std::vector
<sal_uInt8
> saltValue
;
45 std::vector
<sal_uInt8
> encryptedVerifierHashInput
;
46 std::vector
<sal_uInt8
> encryptedVerifierHashValue
;
47 std::vector
<sal_uInt8
> encryptedKeyValue
;
50 class AgileEngine
: public CryptoEngine
52 AgileEncryptionInfo mInfo
;
54 void calculateHashFinal(const OUString
& rPassword
, std::vector
<sal_uInt8
>& aHashFinal
);
57 const sal_uInt8
* rBlock
,
58 sal_uInt32 aBlockSize
,
59 std::vector
<sal_uInt8
>& rHashFinal
,
60 std::vector
<sal_uInt8
>& rInput
,
61 std::vector
<sal_uInt8
>& rOutput
);
63 static Crypto::CryptoType
cryptoType(const AgileEncryptionInfo
& rInfo
);
67 virtual ~AgileEngine();
69 AgileEncryptionInfo
& getInfo() { return mInfo
;}
71 virtual void writeEncryptionInfo(
72 const OUString
& rPassword
,
73 BinaryXOutputStream
& rStream
) override
;
75 virtual bool generateEncryptionKey(const OUString
& rPassword
) override
;
78 BinaryXInputStream
& aInputStream
,
79 BinaryXOutputStream
& aOutputStream
) override
;
82 BinaryXInputStream
& aInputStream
,
83 BinaryXOutputStream
& aOutputStream
) override
;
91 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */