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