xref: /AOO41X/main/xmlsecurity/source/framework/encryptionengine.hxx (revision ec61c6ed669d81c7df08233ccc38d0040f129ece)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _ENCRYPTIONENGINE_HXX
25 #define _ENCRYPTIONENGINE_HXX
26 
27 #include <com/sun/star/xml/crypto/sax/XReferenceResolvedListener.hpp>
28 #include <com/sun/star/xml/crypto/sax/XReferenceResolvedBroadcaster.hpp>
29 #include <com/sun/star/xml/crypto/sax/XBlockerMonitor.hpp>
30 #include <com/sun/star/xml/crypto/sax/XKeyCollector.hpp>
31 #include <com/sun/star/xml/crypto/sax/XMissionTaker.hpp>
32 #include <com/sun/star/xml/crypto/sax/XSAXEventKeeper.hpp>
33 #include <com/sun/star/xml/crypto/XXMLSecurityContext.hpp>
34 #include <com/sun/star/xml/crypto/XXMLEncryption.hpp>
35 #include <cppuhelper/implbase1.hxx>
36 
37 #include "securityengine.hxx"
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  *   HISTORY
53  *  05.01.2004 -    Interface supported: XBlockerMonitor
54  *
55  *   AUTHOR
56  *  Michael Mi
57  *  Email: michael.mi@sun.com
58  ******************************************************************************/
59 {
60 protected:
61     /*
62      * the Encryption bridge component, which performs encrypt and decrypt
63      * operation based on xmlsec library.
64      */
65     com::sun::star::uno::Reference<
66         com::sun::star::xml::crypto::XXMLEncryption > m_xXMLEncryption;
67 
68     /*
69      * the Id of template blocker.
70      */
71     sal_Int32 m_nIdOfBlocker;
72 
73 protected:
74     EncryptionEngine( );
~EncryptionEngine()75     virtual ~EncryptionEngine(){};
76 
77     virtual void tryToPerform( )
78         throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException);
79     virtual void clearUp( ) const;
80     virtual bool checkReady() const;
81 
82     /*
83      * starts the main function. This method will be implemented by any sub-class.
84      * For a Encryptor, it performs encryption operation;
85      * for a Decryptor, decryption operation is performed.
86      */
startEngine(const com::sun::star::uno::Reference<com::sun::star::xml::crypto::XXMLEncryptionTemplate> &)87     virtual void startEngine( const com::sun::star::uno::Reference<
88         com::sun::star::xml::crypto::XXMLEncryptionTemplate >&)
89         throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException)
90         {};
91 
92 public:
93     /* XBlockerMonitor */
94     virtual void SAL_CALL setBlockerId( sal_Int32 id )
95             throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException);
96 };
97 
98 #endif
99 
100