update credits
[LibreOffice.git] / xmlsecurity / source / framework / signatureengine.hxx
blob7844269977c081d9e5f867830aefb4c5c7370769
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 _SIGNATUREENGINE_HXX
21 #define _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>
34 #include <cppuhelper/implbase2.hxx>
36 #include "securityengine.hxx"
38 #include <vector>
40 class SignatureEngine : public cppu::ImplInheritanceHelper2
42 SecurityEngine,
43 com::sun::star::xml::crypto::sax::XReferenceCollector,
44 com::sun::star::xml::crypto::XUriBinding
46 /****** signatureengine.hxx/CLASS SignatureEngine *****************************
48 * NAME
49 * SignatureEngine -- Base class of SignatureCreator and SignatureVerifier
51 * FUNCTION
52 * Maintains common members and methods related with signature operation.
54 * AUTHOR
55 * Michael Mi
56 * Email: michael.mi@sun.com
57 ******************************************************************************/
59 protected:
62 * the Signature bridge component, which performs signature generation
63 * and verification based on xmlsec library.
65 com::sun::star::uno::Reference<
66 com::sun::star::xml::crypto::XXMLSignature > m_xXMLSignature;
69 * a collection of ElementCollector's ids. Each ElementCollector
70 * represents one element signed by this signature.
72 std::vector< sal_Int32 > m_vReferenceIds;
75 * remembers how many references this signature has.
77 sal_Int32 m_nTotalReferenceNumber;
80 * a collection of Uri binding.
82 * the m_vUris is used to hold the Uri strings, and the m_vXInputStreams is used
83 * to hold corresponding binded XInputStream interface.
85 std::vector< OUString > m_vUris;
86 std::vector< com::sun::star::uno::Reference<
87 com::sun::star::io::XInputStream > > m_vXInputStreams;
89 protected:
90 SignatureEngine( );
91 virtual ~SignatureEngine() {};
93 virtual void tryToPerform( )
94 throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException);
95 virtual void clearUp( ) const;
96 virtual bool checkReady() const;
99 * starts the main function. This method will be implemented by any sub-class.
100 * For a SignatureCreator, it performs signing operation;
101 * for a SignatureVerifier, verification operation is performed.
103 virtual void startEngine( const com::sun::star::uno::Reference<
104 com::sun::star::xml::crypto::XXMLSignatureTemplate >&)
105 throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException)
108 public:
109 /* XReferenceCollector */
110 virtual void SAL_CALL setReferenceCount( sal_Int32 count )
111 throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException);
113 virtual void SAL_CALL setReferenceId( sal_Int32 id )
114 throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException);
116 /* XUriBinding */
117 virtual void SAL_CALL setUriBinding(
118 const OUString& uri,
119 const com::sun::star::uno::Reference<
120 com::sun::star::io::XInputStream >& aInputStream )
121 throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException);
122 virtual com::sun::star::uno::Reference< com::sun::star::io::XInputStream >
123 SAL_CALL getUriBinding( const OUString& uri )
124 throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException);
127 #endif
129 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */