Line data Source code
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 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 : #ifndef INCLUDED_XMLSECURITY_SOURCE_FRAMEWORK_ENCRYPTIONENGINE_HXX
21 : #define INCLUDED_XMLSECURITY_SOURCE_FRAMEWORK_ENCRYPTIONENGINE_HXX
22 :
23 : #include <com/sun/star/xml/crypto/sax/XReferenceResolvedListener.hpp>
24 : #include <com/sun/star/xml/crypto/sax/XReferenceResolvedBroadcaster.hpp>
25 : #include <com/sun/star/xml/crypto/sax/XBlockerMonitor.hpp>
26 : #include <com/sun/star/xml/crypto/sax/XKeyCollector.hpp>
27 : #include <com/sun/star/xml/crypto/sax/XMissionTaker.hpp>
28 : #include <com/sun/star/xml/crypto/sax/XSAXEventKeeper.hpp>
29 : #include <com/sun/star/xml/crypto/XXMLSecurityContext.hpp>
30 : #include <com/sun/star/xml/crypto/XXMLEncryption.hpp>
31 : #include <cppuhelper/implbase1.hxx>
32 :
33 : #include "securityengine.hxx"
34 :
35 : namespace com { namespace sun { namespace star { namespace uno {
36 : class XComponentContext;
37 : } } } }
38 :
39 : class EncryptionEngine : public cppu::ImplInheritanceHelper1
40 : <
41 : SecurityEngine,
42 : com::sun::star::xml::crypto::sax::XBlockerMonitor
43 : >
44 : /****** encryptionEngine.hxx/CLASS encryptionEngine ***************************
45 : *
46 : * NAME
47 : * EncryptionEngine -- Base class of Encryptor and Decryptor
48 : *
49 : * FUNCTION
50 : * Maintains common members and methods related with encryption.
51 : *
52 : * AUTHOR
53 : * Michael Mi
54 : * Email: michael.mi@sun.com
55 : ******************************************************************************/
56 : {
57 : private:
58 : com::sun::star::uno::Reference<
59 : com::sun::star::uno::XComponentContext > m_xContext;
60 :
61 : protected:
62 : /*
63 : * the Encryption bridge component, which performs encrypt and decrypt
64 : * operation based on xmlsec library.
65 : */
66 : com::sun::star::uno::Reference<
67 : com::sun::star::xml::crypto::XXMLEncryption > m_xXMLEncryption;
68 :
69 : /*
70 : * the Id of template blocker.
71 : */
72 : sal_Int32 m_nIdOfBlocker;
73 :
74 : protected:
75 : EncryptionEngine( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > & xContext );
76 0 : virtual ~EncryptionEngine(){};
77 :
78 : virtual void tryToPerform( )
79 : throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException) SAL_OVERRIDE;
80 : virtual void clearUp( ) const SAL_OVERRIDE;
81 : virtual bool checkReady() const SAL_OVERRIDE;
82 :
83 : /*
84 : * starts the main function. This method will be implemented by any sub-class.
85 : * For a Encryptor, it performs encryption operation;
86 : * for a Decryptor, decryption operation is performed.
87 : */
88 0 : virtual void startEngine( const com::sun::star::uno::Reference<
89 : com::sun::star::xml::crypto::XXMLEncryptionTemplate >&)
90 : throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException)
91 0 : {};
92 :
93 : public:
94 : /* XBlockerMonitor */
95 : virtual void SAL_CALL setBlockerId( sal_Int32 id )
96 : throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
97 : };
98 :
99 : #endif
100 :
101 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|