Coverage Report

Created: 2025-07-07 10:01

/src/libreoffice/include/oox/crypto/CryptoEngine.hxx
Line
Count
Source
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_CRYPTOENGINE_HXX
12
#define INCLUDED_OOX_CRYPTO_CRYPTOENGINE_HXX
13
14
#include <vector>
15
16
#include <rtl/ustring.hxx>
17
#include <sal/types.h>
18
19
#include <com/sun/star/io/XInputStream.hpp>
20
#include <com/sun/star/io/XOutputStream.hpp>
21
22
namespace oox {
23
    class BinaryXInputStream;
24
    class BinaryXOutputStream;
25
}
26
27
namespace oox::crypto {
28
29
class CryptoEngine
30
{
31
protected:
32
    std::vector<sal_uInt8> mKey;
33
34
public:
35
    CryptoEngine()
36
9.34k
    {}
37
38
    virtual ~CryptoEngine()
39
9.34k
    {}
40
41
    // Decryption
42
    virtual bool readEncryptionInfo(css::uno::Reference<css::io::XInputStream> & rxInputStream) = 0;
43
44
    virtual bool generateEncryptionKey(std::u16string_view rPassword) = 0;
45
46
    virtual bool decrypt(
47
                    BinaryXInputStream& aInputStream,
48
                    BinaryXOutputStream& aOutputStream) = 0;
49
50
    // Encryption
51
    virtual void writeEncryptionInfo(BinaryXOutputStream & rStream) = 0;
52
53
    virtual bool setupEncryption(const OUString& rPassword) = 0;
54
55
    virtual void encrypt(const css::uno::Reference<css::io::XInputStream> & rxInputStream,
56
                         css::uno::Reference<css::io::XOutputStream> & rxOutputStream,
57
                         sal_uInt32 nSize) = 0;
58
59
    virtual bool checkDataIntegrity() = 0;
60
};
61
62
} // namespace oox::crypto
63
64
#endif
65
66
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */