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 <cppuhelper/implbase.hxx>
15 #include <com/sun/star/lang/XServiceInfo.hpp>
16 #include <com/sun/star/packages/XPackageEncryption.hpp>
17 #include <com/sun/star/io/XInputStream.hpp>
19 
20 namespace com::sun::star::uno
21 {
22 class XComponentContext;
23 }
24 
25 namespace oox::crypto
26 {
28  : public cppu::WeakImplHelper<css::lang::XServiceInfo, css::packages::XPackageEncryption>
29 {
30  css::uno::Reference<css::uno::XComponentContext> mxContext;
31  std::unique_ptr<CryptoEngine> mCryptoEngine;
32 
33  css::uno::Reference<css::io::XInputStream>
34  getStream(const css::uno::Sequence<css::beans::NamedValue>& rStreams,
35  std::u16string_view sStreamName);
36 
37 public:
38  StrongEncryptionDataSpace(const css::uno::Reference<css::uno::XComponentContext>& rxContext);
39 
40  // Decryption
41 
42  virtual sal_Bool SAL_CALL generateEncryptionKey(const OUString& rPassword) override;
43  virtual sal_Bool SAL_CALL
44  readEncryptionInfo(const css::uno::Sequence<css::beans::NamedValue>& aStreams) override;
45  virtual sal_Bool SAL_CALL
46  decrypt(const css::uno::Reference<css::io::XInputStream>& rxInputStream,
47  css::uno::Reference<css::io::XOutputStream>& rxOutputStream) override;
48 
49  virtual sal_Bool SAL_CALL checkDataIntegrity() override;
50 
51  // Encryption
52 
53  virtual css::uno::Sequence<css::beans::NamedValue>
54  SAL_CALL encrypt(const css::uno::Reference<css::io::XInputStream>& rxInputStream) override;
55 
56  virtual sal_Bool SAL_CALL
57  setupEncryption(const css::uno::Sequence<css::beans::NamedValue>& rMediaEncData) override;
58 
59  virtual css::uno::Sequence<css::beans::NamedValue>
60  SAL_CALL createEncryptionData(const OUString& rPassword) override;
61 
62  // com.sun.star.lang.XServiceInfo
63  virtual OUString SAL_CALL getImplementationName() override;
64  virtual sal_Bool SAL_CALL supportsService(const OUString& rServiceName) override;
65  virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
66 };
67 
68 } // namespace oox::crypto
69 
70 #endif
71 
72 /* 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