merged tag ooo/OOO330_m14
[LibreOffice.git] / xmlsecurity / source / framework / signatureengine.hxx
blobb36cd6aa644281f383596328ce43bc20ffe88dcb
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
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.
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).
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.
26 ************************************************************************/
28 #ifndef _SIGNATUREENGINE_HXX
29 #define _SIGNATUREENGINE_HXX
31 #include <com/sun/star/xml/crypto/sax/XReferenceResolvedListener.hpp>
32 #include <com/sun/star/xml/crypto/sax/XReferenceResolvedBroadcaster.hpp>
33 #ifndef _COM_SUN_STAR_XML_CRYPTO_SAX_XSIGNATURECOLLECTOR_HPP_
34 #include <com/sun/star/xml/crypto/sax/XReferenceCollector.hpp>
35 #endif
36 #include <com/sun/star/xml/crypto/sax/XKeyCollector.hpp>
37 #include <com/sun/star/xml/crypto/sax/XMissionTaker.hpp>
38 #include <com/sun/star/xml/crypto/sax/XSAXEventKeeper.hpp>
39 #include <com/sun/star/xml/crypto/XXMLSecurityContext.hpp>
40 #include <com/sun/star/xml/crypto/XXMLSignature.hpp>
41 #include <com/sun/star/xml/crypto/XUriBinding.hpp>
42 #include <com/sun/star/io/XInputStream.hpp>
44 #include <cppuhelper/implbase2.hxx>
46 #include "securityengine.hxx"
48 #ifndef INCLUDED_VECTOR
49 #include <vector>
50 #define INCLUDED_VECTOR
51 #endif
53 class SignatureEngine : public cppu::ImplInheritanceHelper2
55 SecurityEngine,
56 com::sun::star::xml::crypto::sax::XReferenceCollector,
57 com::sun::star::xml::crypto::XUriBinding
59 /****** signatureengine.hxx/CLASS SignatureEngine *****************************
61 * NAME
62 * SignatureEngine -- Base class of SignatureCreator and SignatureVerifier
64 * FUNCTION
65 * Maintains common members and methods related with signature operation.
67 * HISTORY
68 * 05.01.2004 - Interface supported: XReferenceCollector
70 * AUTHOR
71 * Michael Mi
72 * Email: michael.mi@sun.com
73 ******************************************************************************/
75 protected:
78 * the Signature bridge component, which performs signature generation
79 * and verification based on xmlsec library.
81 com::sun::star::uno::Reference<
82 com::sun::star::xml::crypto::XXMLSignature > m_xXMLSignature;
85 * a collection of ElementCollector's ids. Each ElementCollector
86 * represents one element signed by this signature.
88 std::vector< sal_Int32 > m_vReferenceIds;
91 * remembers how many references this signature has.
93 sal_Int32 m_nTotalReferenceNumber;
96 * a collection of Uri binding.
98 * the m_vUris is used to hold the Uri strings, and the m_vXInputStreams is used
99 * to hold corresponding binded XInputStream interface.
101 std::vector< rtl::OUString > m_vUris;
102 std::vector< com::sun::star::uno::Reference<
103 com::sun::star::io::XInputStream > > m_vXInputStreams;
105 protected:
106 SignatureEngine( );
107 virtual ~SignatureEngine() {};
109 virtual void tryToPerform( )
110 throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException);
111 virtual void clearUp( ) const;
112 virtual bool checkReady() const;
115 * starts the main function. This method will be implemented by any sub-class.
116 * For a SignatureCreator, it performs signing operation;
117 * for a SignatureVerifier, verification operation is performed.
119 virtual void startEngine( const com::sun::star::uno::Reference<
120 com::sun::star::xml::crypto::XXMLSignatureTemplate >&)
121 throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException)
124 public:
125 /* XReferenceCollector */
126 virtual void SAL_CALL setReferenceCount( sal_Int32 count )
127 throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException);
129 virtual void SAL_CALL setReferenceId( sal_Int32 id )
130 throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException);
132 /* XUriBinding */
133 virtual void SAL_CALL setUriBinding(
134 const rtl::OUString& uri,
135 const com::sun::star::uno::Reference<
136 com::sun::star::io::XInputStream >& aInputStream )
137 throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException);
138 virtual com::sun::star::uno::Reference< com::sun::star::io::XInputStream >
139 SAL_CALL getUriBinding( const rtl::OUString& uri )
140 throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException);
143 #endif