Update ooo320-m1
[ooovba.git] / xmlsecurity / source / framework / signatureengine.hxx
blob4a804f40ccc80527b3690727353fcf475a83c376
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: signatureengine.hxx,v $
10 * $Revision: 1.4 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _SIGNATUREENGINE_HXX
32 #define _SIGNATUREENGINE_HXX
34 #include <com/sun/star/xml/crypto/sax/XReferenceResolvedListener.hpp>
35 #include <com/sun/star/xml/crypto/sax/XReferenceResolvedBroadcaster.hpp>
36 #ifndef _COM_SUN_STAR_XML_CRYPTO_SAX_XSIGNATURECOLLECTOR_HPP_
37 #include <com/sun/star/xml/crypto/sax/XReferenceCollector.hpp>
38 #endif
39 #include <com/sun/star/xml/crypto/sax/XKeyCollector.hpp>
40 #include <com/sun/star/xml/crypto/sax/XMissionTaker.hpp>
41 #include <com/sun/star/xml/crypto/sax/XSAXEventKeeper.hpp>
42 #include <com/sun/star/xml/crypto/XXMLSecurityContext.hpp>
43 #include <com/sun/star/xml/crypto/XXMLSignature.hpp>
44 #include <com/sun/star/xml/crypto/XUriBinding.hpp>
45 #include <com/sun/star/io/XInputStream.hpp>
47 #include <cppuhelper/implbase2.hxx>
49 #include "securityengine.hxx"
51 #ifndef INCLUDED_VECTOR
52 #include <vector>
53 #define INCLUDED_VECTOR
54 #endif
56 class SignatureEngine : public cppu::ImplInheritanceHelper2
58 SecurityEngine,
59 com::sun::star::xml::crypto::sax::XReferenceCollector,
60 com::sun::star::xml::crypto::XUriBinding
62 /****** signatureengine.hxx/CLASS SignatureEngine *****************************
64 * NAME
65 * SignatureEngine -- Base class of SignatureCreator and SignatureVerifier
67 * FUNCTION
68 * Maintains common members and methods related with signature operation.
70 * HISTORY
71 * 05.01.2004 - Interface supported: XReferenceCollector
73 * AUTHOR
74 * Michael Mi
75 * Email: michael.mi@sun.com
76 ******************************************************************************/
78 protected:
81 * the Signature bridge component, which performs signature generation
82 * and verification based on xmlsec library.
84 com::sun::star::uno::Reference<
85 com::sun::star::xml::crypto::XXMLSignature > m_xXMLSignature;
88 * a collection of ElementCollector's ids. Each ElementCollector
89 * represents one element signed by this signature.
91 std::vector< sal_Int32 > m_vReferenceIds;
94 * remembers how many references this signature has.
96 sal_Int32 m_nTotalReferenceNumber;
99 * a collection of Uri binding.
101 * the m_vUris is used to hold the Uri strings, and the m_vXInputStreams is used
102 * to hold corresponding binded XInputStream interface.
104 std::vector< rtl::OUString > m_vUris;
105 std::vector< com::sun::star::uno::Reference<
106 com::sun::star::io::XInputStream > > m_vXInputStreams;
108 protected:
109 SignatureEngine( );
110 virtual ~SignatureEngine() {};
112 virtual void tryToPerform( )
113 throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException);
114 virtual void clearUp( ) const;
115 virtual bool checkReady() const;
118 * starts the main function. This method will be implemented by any sub-class.
119 * For a SignatureCreator, it performs signing operation;
120 * for a SignatureVerifier, verification operation is performed.
122 virtual void startEngine( const com::sun::star::uno::Reference<
123 com::sun::star::xml::crypto::XXMLSignatureTemplate >&)
124 throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException)
127 public:
128 /* XReferenceCollector */
129 virtual void SAL_CALL setReferenceCount( sal_Int32 count )
130 throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException);
132 virtual void SAL_CALL setReferenceId( sal_Int32 id )
133 throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException);
135 /* XUriBinding */
136 virtual void SAL_CALL setUriBinding(
137 const rtl::OUString& uri,
138 const com::sun::star::uno::Reference<
139 com::sun::star::io::XInputStream >& aInputStream )
140 throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException);
141 virtual com::sun::star::uno::Reference< com::sun::star::io::XInputStream >
142 SAL_CALL getUriBinding( const rtl::OUString& uri )
143 throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException);
146 #endif