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 struct AgileEncryptionInfo
37 OUString cipherAlgorithm
;
38 OUString cipherChaining
;
39 OUString hashAlgorithm
;
41 std::vector
<sal_uInt8
> keyDataSalt
;
42 std::vector
<sal_uInt8
> saltValue
;
43 std::vector
<sal_uInt8
> encryptedVerifierHashInput
;
44 std::vector
<sal_uInt8
> encryptedVerifierHashValue
;
45 std::vector
<sal_uInt8
> encryptedKeyValue
;
48 class AgileEngine
: public CryptoEngine
50 AgileEncryptionInfo mInfo
;
52 void calculateHashFinal(const OUString
& rPassword
, std::vector
<sal_uInt8
>& aHashFinal
);
55 std::vector
<sal_uInt8
> const & rBlock
,
56 std::vector
<sal_uInt8
>& rHashFinal
,
57 std::vector
<sal_uInt8
>& rInput
,
58 std::vector
<sal_uInt8
>& rOutput
);
60 static Crypto::CryptoType
cryptoType(const AgileEncryptionInfo
& rInfo
);
63 AgileEngine() = default;
65 AgileEncryptionInfo
& getInfo() { return mInfo
;}
67 virtual void writeEncryptionInfo(
68 const OUString
& rPassword
,
69 BinaryXOutputStream
& rStream
) override
;
71 virtual bool generateEncryptionKey(const OUString
& rPassword
) override
;
74 BinaryXInputStream
& aInputStream
,
75 BinaryXOutputStream
& aOutputStream
) override
;
78 BinaryXInputStream
& aInputStream
,
79 BinaryXOutputStream
& aOutputStream
) override
;
87 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */