fdo#74697 Add Bluez 5 support for impress remote.
[LibreOffice.git] / xmlsecurity / source / framework / securityengine.hxx
blobffba6b7719c1635fdeed89f3f1cb4edd14dc54c3
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef _SECURITYENGINE_HXX
21 #define _SECURITYENGINE_HXX
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/XKeyCollector.hpp>
26 #include <com/sun/star/xml/crypto/sax/XMissionTaker.hpp>
27 #include <com/sun/star/xml/crypto/sax/XSAXEventKeeper.hpp>
28 #include <com/sun/star/xml/crypto/XXMLSignature.hpp>
30 #include <cppuhelper/implbase3.hxx>
32 class SecurityEngine : public cppu::WeakImplHelper3
34 com::sun::star::xml::crypto::sax::XReferenceResolvedListener,
35 com::sun::star::xml::crypto::sax::XKeyCollector,
36 com::sun::star::xml::crypto::sax::XMissionTaker
38 /****** securityengine.hxx/CLASS SecurityEngine *******************************
40 * NAME
41 * SecurityEngine -- Base class of SignatureEngine and EncryptionEngine
43 * FUNCTION
44 * Maintains common members and methods related with security engine
45 * operation.
47 * AUTHOR
48 * Michael Mi
49 * Email: michael.mi@sun.com
50 ******************************************************************************/
52 protected:
53 com::sun::star::uno::Reference<
54 com::sun::star::lang::XMultiServiceFactory > mxMSF;
57 * A SAXEventKeeper internally maintians all resources that a security
58 * operation needs. The m_xSAXEventKeeper member is used to release
59 * those resources when the security operation finishes.
61 com::sun::star::uno::Reference<
62 com::sun::star::xml::crypto::sax::XSAXEventKeeper > m_xSAXEventKeeper;
65 * the id of ElementCollector of the template element.
66 * For a signature, the template element is the Signature element,
67 * for a encryption, the EncryptedData/EncryptedKey element is.
69 sal_Int32 m_nIdOfTemplateEC;
72 * remembers how many referenced elements have been bufferred completely,
73 * including the key element, template element, and referenced element of
74 * signature.
76 sal_Int32 m_nNumOfResolvedReferences;
79 * the id of ElementCollector of the key element.
80 * If a Signature element or EncryptedData/EncryptedKey element has
81 * an internal key sub-element, then this member should be -1
83 sal_Int32 m_nIdOfKeyEC;
86 * remembers whether the current opertion has finished.
88 bool m_bMissionDone;
91 * the Id of the security entity, a signature or encryption, which is used for
92 * the result listener to identify the entity.
94 sal_Int32 m_nSecurityId;
97 * the status of the operation
99 com::sun::star::xml::crypto::SecurityOperationStatus m_nStatus;
102 * the result listener, which will receives the security operation result.
104 com::sun::star::uno::Reference<
105 com::sun::star::uno::XInterface >
106 m_xResultListener;
108 protected:
109 explicit SecurityEngine( const com::sun::star::uno::Reference<
110 com::sun::star::lang::XMultiServiceFactory >& rxMSF = NULL );
111 virtual ~SecurityEngine() {};
114 * perform the security operation.
115 * Any derived class will implement this method respectively.
117 virtual void tryToPerform( )
118 throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException){};
121 * clear up all resources used by this operation.
122 * This method is called after the operation finishes, or a End-Your-Mission
123 * message is received.
124 * Any derived class will implement this method respectively.
126 virtual void clearUp( ) const {};
129 * notifies any possible result listener.
130 * When verify a signature or conduct a decryption, the operation result will
131 * be transferred to a listener by this method.
132 * Any derived class will implement this method respectively.
134 virtual void notifyResultListener() const
135 throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException)
139 * checks whether everything is ready.
140 * Any derived class will implement this method respectively.
142 virtual bool checkReady() const { return true; };
144 public:
145 /* XReferenceResolvedListener */
146 virtual void SAL_CALL referenceResolved( sal_Int32 referenceId )
147 throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException);
149 /* XKeyCollector */
150 virtual void SAL_CALL setKeyId( sal_Int32 id )
151 throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException);
153 /* XMissionTaker */
154 virtual sal_Bool SAL_CALL endMission( )
155 throw (com::sun::star::uno::RuntimeException);
158 #endif
160 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */