Version 5.4.3.2, tag libreoffice-5.4.3.2
[LibreOffice.git] / include / oox / crypto / DocumentDecryption.hxx
blobfbd5e36eb74703f68217b8d3515bb93d5a66db14
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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/.
9 */
11 #ifndef INCLUDED_OOX_CRYPTO_DOCUMENTDECRYPTION_HXX
12 #define INCLUDED_OOX_CRYPTO_DOCUMENTDECRYPTION_HXX
14 #include <oox/dllapi.h>
16 #include <memory>
18 #include <com/sun/star/uno/Reference.hxx>
19 #include <com/sun/star/uno/Sequence.hxx>
20 #include <oox/crypto/CryptoEngine.hxx>
21 #include <rtl/ustring.hxx>
23 namespace com { namespace sun { namespace star {
24 namespace beans { struct NamedValue; }
25 namespace io { class XInputStream; }
26 namespace io { class XStream; }
27 namespace uno { class XComponentContext; }
28 } } }
30 namespace oox { class BinaryInputStream; }
31 namespace oox { namespace ole { class OleStorage; } }
33 namespace oox {
34 namespace core {
36 class OOX_DLLPUBLIC DocumentDecryption
38 private:
39 css::uno::Reference< css::uno::XComponentContext > mxContext;
41 enum CryptoType
43 UNKNOWN,
44 STANDARD_2007,
45 AGILE
48 oox::ole::OleStorage& mrOleStorage;
49 std::unique_ptr<CryptoEngine> mEngine;
50 CryptoType mCryptoType;
52 bool readAgileEncryptionInfo( css::uno::Reference< css::io::XInputStream >& rStream );
53 bool readStandard2007EncryptionInfo( BinaryInputStream& rStream );
55 public:
56 DocumentDecryption(
57 oox::ole::OleStorage& rOleStorage,
58 css::uno::Reference< css::uno::XComponentContext > const & xContext);
60 bool decrypt(const css::uno::Reference< css::io::XStream >& xDocumentStream);
61 bool readEncryptionInfo();
62 bool generateEncryptionKey(const OUString& rPassword);
64 css::uno::Sequence< css::beans::NamedValue > createEncryptionData(const OUString& rPassword);
68 } // namespace core
69 } // namespace oox
71 #endif
73 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */