1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef _ENCRYPTIONENGINE_HXX
29 #define _ENCRYPTIONENGINE_HXX
30 
31 #include <com/sun/star/xml/crypto/sax/XReferenceResolvedListener.hpp>
32 #include <com/sun/star/xml/crypto/sax/XReferenceResolvedBroadcaster.hpp>
33 #include <com/sun/star/xml/crypto/sax/XBlockerMonitor.hpp>
34 #include <com/sun/star/xml/crypto/sax/XKeyCollector.hpp>
35 #include <com/sun/star/xml/crypto/sax/XMissionTaker.hpp>
36 #include <com/sun/star/xml/crypto/sax/XSAXEventKeeper.hpp>
37 #include <com/sun/star/xml/crypto/XXMLSecurityContext.hpp>
38 #include <com/sun/star/xml/crypto/XXMLEncryption.hpp>
39 #include <cppuhelper/implbase1.hxx>
40 
41 #include "securityengine.hxx"
42 
43 class EncryptionEngine : public cppu::ImplInheritanceHelper1
44 <
45 	SecurityEngine,
46 	com::sun::star::xml::crypto::sax::XBlockerMonitor
47 >
48 /****** encryptionEngine.hxx/CLASS encryptionEngine ***************************
49  *
50  *   NAME
51  *	EncryptionEngine -- Base class of Encryptor and Decryptor
52  *
53  *   FUNCTION
54  *	Maintains common members and methods related with encryption.
55  *
56  *   HISTORY
57  *	05.01.2004 -	Interface supported: XBlockerMonitor
58  *
59  *   AUTHOR
60  *	Michael Mi
61  *	Email: michael.mi@sun.com
62  ******************************************************************************/
63 {
64 protected:
65 	/*
66 	 * the Encryption bridge component, which performs encrypt and decrypt
67 	 * operation based on xmlsec library.
68 	 */
69 	com::sun::star::uno::Reference<
70 		com::sun::star::xml::crypto::XXMLEncryption > m_xXMLEncryption;
71 
72 	/*
73 	 * the Id of template blocker.
74 	 */
75 	sal_Int32 m_nIdOfBlocker;
76 
77 protected:
78 	EncryptionEngine( );
79 	virtual ~EncryptionEngine(){};
80 
81 	virtual void tryToPerform( )
82 		throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException);
83 	virtual void clearUp( ) const;
84 	virtual bool checkReady() const;
85 
86 	/*
87 	 * starts the main function. This method will be implemented by any sub-class.
88 	 * For a Encryptor, it performs encryption operation;
89 	 * for a Decryptor, decryption operation is performed.
90 	 */
91 	virtual void startEngine( const com::sun::star::uno::Reference<
92 		com::sun::star::xml::crypto::XXMLEncryptionTemplate >&)
93 		throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException)
94 		{};
95 
96 public:
97 	/* XBlockerMonitor */
98 	virtual void SAL_CALL setBlockerId( sal_Int32 id )
99     		throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException);
100 };
101 
102 #endif
103 
104