nss: upgrade to release 3.73
[LibreOffice.git] / xmlsecurity / inc / framework / securityengine.hxx
blob980d61a6570afc9b3d31f7fec438a6434fe1e76b
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 INCLUDED_XMLSECURITY_INC_FRAMEWORK_SECURITYENGINE_HXX
21 #define INCLUDED_XMLSECURITY_INC_FRAMEWORK_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/implbase.hxx>
32 #include <xmlsecuritydllapi.h>
34 class SAL_DLLPUBLIC_RTTI SecurityEngine : public cppu::WeakImplHelper
36 css::xml::crypto::sax::XReferenceResolvedListener,
37 css::xml::crypto::sax::XKeyCollector,
38 css::xml::crypto::sax::XMissionTaker
40 /****** securityengine.hxx/CLASS SecurityEngine *******************************
42 * NAME
43 * SecurityEngine -- Base class of SignatureEngine and EncryptionEngine
45 * FUNCTION
46 * Maintains common members and methods related with security engine
47 * operation.
48 ******************************************************************************/
50 protected:
53 * A SAXEventKeeper internally maintains all resources that a security
54 * operation needs. The m_xSAXEventKeeper member is used to release
55 * those resources when the security operation finishes.
57 css::uno::Reference< css::xml::crypto::sax::XSAXEventKeeper > m_xSAXEventKeeper;
60 * the id of ElementCollector of the template element.
61 * For a signature, the template element is the Signature element,
62 * for an encryption, the EncryptedData/EncryptedKey element is.
64 sal_Int32 m_nIdOfTemplateEC;
67 * remembers how many referenced elements have been buffered completely,
68 * including the key element, template element, and referenced element of
69 * signature.
71 sal_Int32 m_nNumOfResolvedReferences;
74 * the id of ElementCollector of the key element.
75 * If a Signature element or EncryptedData/EncryptedKey element has
76 * an internal key sub-element, then this member should be -1
78 sal_Int32 m_nIdOfKeyEC;
81 * remembers whether the current operation has finished.
83 bool m_bMissionDone;
86 * the Id of the security entity, a signature or encryption, which is used for
87 * the result listener to identify the entity.
89 sal_Int32 m_nSecurityId;
92 * the status of the operation
94 css::xml::crypto::SecurityOperationStatus m_nStatus;
97 * the result listener, which will receives the security operation result.
99 css::uno::Reference< css::uno::XInterface > m_xResultListener;
101 protected:
102 explicit SecurityEngine();
103 virtual ~SecurityEngine() override {};
106 * perform the security operation.
107 * Any derived class will implement this method respectively.
109 /// @throws css::uno::Exception
110 /// @throws css::uno::RuntimeException
111 virtual void tryToPerform( ){};
114 * clear up all resources used by this operation.
115 * This method is called after the operation finishes, or a End-Your-Mission
116 * message is received.
117 * Any derived class will implement this method respectively.
119 virtual void clearUp( ) const {};
122 * notifies any possible result listener.
123 * When verify a signature or conduct a decryption, the operation result will
124 * be transferred to a listener by this method.
125 * Any derived class will implement this method respectively.
127 /// @throws css::uno::Exception
128 /// @throws css::uno::RuntimeException
129 virtual void notifyResultListener() const
132 public:
133 /* XReferenceResolvedListener */
134 virtual void SAL_CALL referenceResolved( sal_Int32 referenceId ) override;
136 /* XKeyCollector */
137 virtual void SAL_CALL setKeyId( sal_Int32 id ) override;
139 /* XMissionTaker */
140 virtual sal_Bool SAL_CALL endMission( ) override;
143 #endif
145 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */