LibreOffice Module oox (master)  1
StrongEncryptionDataSpace.hxx
Go to the documentation of this file.
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_STRONGENCRYPTINDATASPACE_HXX
12 #define INCLUDED_OOX_CRYPTO_STRONGENCRYPTINDATASPACE_HXX
13 
14 #include <sal/config.h>
15 
16 #include <memory>
17 
18 #include <cppuhelper/implbase.hxx>
19 #include <com/sun/star/lang/XServiceInfo.hpp>
20 #include <com/sun/star/packages/XPackageEncryption.hpp>
21 #include <com/sun/star/io/XInputStream.hpp>
23 
24 namespace com::sun::star::uno
25 {
26 class XComponentContext;
27 }
28 
29 namespace oox::crypto
30 {
32  : public cppu::WeakImplHelper<css::lang::XServiceInfo, css::packages::XPackageEncryption>
33 {
34  css::uno::Reference<css::uno::XComponentContext> mxContext;
35  std::unique_ptr<CryptoEngine> mCryptoEngine;
36 
37  css::uno::Reference<css::io::XInputStream>
38  getStream(const css::uno::Sequence<css::beans::NamedValue>& rStreams,
39  std::u16string_view sStreamName);
40 
41 public:
42  StrongEncryptionDataSpace(const css::uno::Reference<css::uno::XComponentContext>& rxContext);
43 
44  // Decryption
45 
46  virtual sal_Bool SAL_CALL generateEncryptionKey(const OUString& rPassword) override;
47  virtual sal_Bool SAL_CALL
48  readEncryptionInfo(const css::uno::Sequence<css::beans::NamedValue>& aStreams) override;
49  virtual sal_Bool SAL_CALL
50  decrypt(const css::uno::Reference<css::io::XInputStream>& rxInputStream,
51  css::uno::Reference<css::io::XOutputStream>& rxOutputStream) override;
52 
53  virtual sal_Bool SAL_CALL checkDataIntegrity() override;
54 
55  // Encryption
56 
57  virtual css::uno::Sequence<css::beans::NamedValue>
58  SAL_CALL encrypt(const css::uno::Reference<css::io::XInputStream>& rxInputStream) override;
59 
60  virtual sal_Bool SAL_CALL
61  setupEncryption(const css::uno::Sequence<css::beans::NamedValue>& rMediaEncData) override;
62 
63  virtual css::uno::Sequence<css::beans::NamedValue>
64  SAL_CALL createEncryptionData(const OUString& rPassword) override;
65 
66  // com.sun.star.lang.XServiceInfo
67  virtual OUString SAL_CALL getImplementationName() override;
68  virtual sal_Bool SAL_CALL supportsService(const OUString& rServiceName) override;
69  virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
70 };
71 
72 } // namespace oox::crypto
73 
74 #endif
75 
76 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
css::uno::Reference< css::uno::XComponentContext > mxContext
virtual css::uno::Sequence< css::beans::NamedValue > SAL_CALL encrypt(const css::uno::Reference< css::io::XInputStream > &rxInputStream) override
virtual sal_Bool SAL_CALL checkDataIntegrity() override
css::uno::Reference< css::io::XInputStream > getStream(const css::uno::Sequence< css::beans::NamedValue > &rStreams, std::u16string_view sStreamName)
virtual sal_Bool SAL_CALL generateEncryptionKey(const OUString &rPassword) override
StrongEncryptionDataSpace(const css::uno::Reference< css::uno::XComponentContext > &rxContext)
virtual sal_Bool SAL_CALL setupEncryption(const css::uno::Sequence< css::beans::NamedValue > &rMediaEncData) override
std::unique_ptr< CryptoEngine > mCryptoEngine
unsigned char sal_Bool
virtual css::uno::Sequence< css::beans::NamedValue > SAL_CALL createEncryptionData(const OUString &rPassword) override
virtual sal_Bool SAL_CALL supportsService(const OUString &rServiceName) override
virtual OUString SAL_CALL getImplementationName() override
virtual sal_Bool SAL_CALL readEncryptionInfo(const css::uno::Sequence< css::beans::NamedValue > &aStreams) override
virtual sal_Bool SAL_CALL decrypt(const css::uno::Reference< css::io::XInputStream > &rxInputStream, css::uno::Reference< css::io::XOutputStream > &rxOutputStream) override