Bump version to 5.0-14
[LibreOffice.git] / xmlsecurity / source / framework / signatureengine.hxx
blob23c7cdedf3c47be02a5a7392ffd1ba1cec35c25c
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_SOURCE_FRAMEWORK_SIGNATUREENGINE_HXX
21 #define INCLUDED_XMLSECURITY_SOURCE_FRAMEWORK_SIGNATUREENGINE_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/XReferenceCollector.hpp>
26 #include <com/sun/star/xml/crypto/sax/XKeyCollector.hpp>
27 #include <com/sun/star/xml/crypto/sax/XMissionTaker.hpp>
28 #include <com/sun/star/xml/crypto/sax/XSAXEventKeeper.hpp>
29 #include <com/sun/star/xml/crypto/XXMLSecurityContext.hpp>
30 #include <com/sun/star/xml/crypto/XXMLSignature.hpp>
31 #include <com/sun/star/xml/crypto/XUriBinding.hpp>
32 #include <com/sun/star/io/XInputStream.hpp>
33 #include <com/sun/star/uno/XComponentContext.hpp>
35 #include <cppuhelper/implbase2.hxx>
37 #include "securityengine.hxx"
39 #include <vector>
41 class SignatureEngine : public cppu::ImplInheritanceHelper2
43 SecurityEngine,
44 com::sun::star::xml::crypto::sax::XReferenceCollector,
45 com::sun::star::xml::crypto::XUriBinding
47 /****** signatureengine.hxx/CLASS SignatureEngine *****************************
49 * NAME
50 * SignatureEngine -- Base class of SignatureCreator and SignatureVerifier
52 * FUNCTION
53 * Maintains common members and methods related with signature operation.
55 * AUTHOR
56 * Michael Mi
57 * Email: michael.mi@sun.com
58 ******************************************************************************/
60 private:
61 com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > m_xContext;
63 protected:
66 * the Signature bridge component, which performs signature generation
67 * and verification based on xmlsec library.
69 com::sun::star::uno::Reference<
70 com::sun::star::xml::crypto::XXMLSignature > m_xXMLSignature;
73 * a collection of ElementCollector's ids. Each ElementCollector
74 * represents one element signed by this signature.
76 std::vector< sal_Int32 > m_vReferenceIds;
79 * remembers how many references this signature has.
81 sal_Int32 m_nTotalReferenceNumber;
84 * a collection of Uri binding.
86 * the m_vUris is used to hold the Uri strings, and the m_vXInputStreams is used
87 * to hold corresponding binded XInputStream interface.
89 std::vector< OUString > m_vUris;
90 std::vector< com::sun::star::uno::Reference<
91 com::sun::star::io::XInputStream > > m_vXInputStreams;
93 protected:
94 explicit SignatureEngine( const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > & xContext);
95 virtual ~SignatureEngine() {};
97 virtual void tryToPerform( )
98 throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException) SAL_OVERRIDE;
99 virtual void clearUp( ) const SAL_OVERRIDE;
100 virtual bool checkReady() const SAL_OVERRIDE;
103 * starts the main function. This method will be implemented by any sub-class.
104 * For a SignatureCreator, it performs signing operation;
105 * for a SignatureVerifier, verification operation is performed.
107 virtual void startEngine( const com::sun::star::uno::Reference<
108 com::sun::star::xml::crypto::XXMLSignatureTemplate >&)
109 throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException)
112 public:
113 /* XReferenceCollector */
114 virtual void SAL_CALL setReferenceCount( sal_Int32 count )
115 throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
117 virtual void SAL_CALL setReferenceId( sal_Int32 id )
118 throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
120 /* XUriBinding */
121 virtual void SAL_CALL setUriBinding(
122 const OUString& uri,
123 const com::sun::star::uno::Reference<
124 com::sun::star::io::XInputStream >& aInputStream )
125 throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
126 virtual com::sun::star::uno::Reference< com::sun::star::io::XInputStream >
127 SAL_CALL getUriBinding( const OUString& uri )
128 throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
131 #endif
133 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */