1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _SIGNATURECREATORIMPL_HXX
25 #define _SIGNATURECREATORIMPL_HXX
26 
27 #include <com/sun/star/xml/crypto/sax/XBlockerMonitor.hpp>
28 #include <com/sun/star/xml/crypto/sax/XSignatureCreationResultListener.hpp>
29 #include <com/sun/star/xml/crypto/sax/XSignatureCreationResultBroadcaster.hpp>
30 #include <com/sun/star/xml/crypto/XSecurityEnvironment.hpp>
31 #include <com/sun/star/lang/XInitialization.hpp>
32 #include <com/sun/star/lang/XServiceInfo.hpp>
33 #include <cppuhelper/implbase4.hxx>
34 
35 #include "signatureengine.hxx"
36 
37 class SignatureCreatorImpl : public cppu::ImplInheritanceHelper4
38 <
39 	SignatureEngine,
40 	com::sun::star::xml::crypto::sax::XBlockerMonitor,
41 	com::sun::star::xml::crypto::sax::XSignatureCreationResultBroadcaster,
42 	com::sun::star::lang::XInitialization,
43 	com::sun::star::lang::XServiceInfo
44 >
45 /****** SignatureCreatorImpl.hxx/CLASS SignatureCreatorImpl *******************
46  *
47  *   NAME
48  *	SignatureCreatorImpl -- generates a signature
49  *
50  *   FUNCTION
51  *	Collects all resources for a signature generation, then generates the
52  *	signature by invoking a xmlsec-based signature bridge component.
53  *
54  *   HISTORY
55  *	05.01.2004 -	Interface supported: XBlockerMonitor,
56  * 			XInitialization, XServiceInfo
57  *
58  *   AUTHOR
59  *	Michael Mi
60  *	Email: michael.mi@sun.com
61  ******************************************************************************/
62 {
63 private:
64 	/*
65 	 * the Id of the signature, which is used for the result listener to
66 	 * identify the signature.
67 	 */
68 	sal_Int32 m_nSignatureId;
69 
70 	/*
71 	 * the Id of template blocker.
72 	 */
73 	sal_Int32 m_nIdOfBlocker;
74 
75 	/*
76 	 * the signature creation result
77 	 */
78 	bool      m_bCreationSucceed;
79 
80 	com::sun::star::uno::Reference<
81 		com::sun::star::xml::crypto::XSecurityEnvironment > m_xSecurityEnvironment;
82 
83 	virtual void notifyResultListener() const
84 		throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException);
85 	virtual void clearUp( ) const;
86 	virtual bool checkReady() const;
87 	virtual void startEngine( const com::sun::star::uno::Reference<
88 		com::sun::star::xml::crypto::XXMLSignatureTemplate >&
89 		xSignatureTemplate)
90 		throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException);
91 
92 public:
93 	explicit SignatureCreatorImpl( const com::sun::star::uno::Reference<
94 		com::sun::star::lang::XMultiServiceFactory >& rxMSF);
95 	virtual ~SignatureCreatorImpl();
96 
97 	/* XBlockerMonitor */
98 	virtual void SAL_CALL setBlockerId( sal_Int32 id )
99     		throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException);
100 
101 	/* XSignatureCreationResultBroadcaster */
102 	void SAL_CALL addSignatureCreationResultListener(
103 		const com::sun::star::uno::Reference<
104 			com::sun::star::xml::crypto::sax::XSignatureCreationResultListener >& listener )
105 		throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException);
106 
107 	void SAL_CALL removeSignatureCreationResultListener(
108 		const com::sun::star::uno::Reference<
109 			com::sun::star::xml::crypto::sax::XSignatureCreationResultListener >& listener )
110 		throw (com::sun::star::uno::RuntimeException);
111 
112 	/* XInitialization */
113 	virtual void SAL_CALL initialize(
114 		const com::sun::star::uno::Sequence< com::sun::star::uno::Any >& aArguments )
115 		throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException);
116 
117 	/* XServiceInfo */
118 	virtual rtl::OUString SAL_CALL getImplementationName(  )
119 		throw (com::sun::star::uno::RuntimeException);
120 	virtual sal_Bool SAL_CALL supportsService( const rtl::OUString& ServiceName )
121 		throw (com::sun::star::uno::RuntimeException);
122 	virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames(  )
123 		throw (com::sun::star::uno::RuntimeException);
124 };
125 
126 rtl::OUString SignatureCreatorImpl_getImplementationName()
127 	throw ( com::sun::star::uno::RuntimeException );
128 
129 sal_Bool SAL_CALL SignatureCreatorImpl_supportsService( const rtl::OUString& ServiceName )
130 	throw ( com::sun::star::uno::RuntimeException );
131 
132 com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL SignatureCreatorImpl_getSupportedServiceNames(  )
133 	throw ( com::sun::star::uno::RuntimeException );
134 
135 com::sun::star::uno::Reference< com::sun::star::uno::XInterface >
136 SAL_CALL SignatureCreatorImpl_createInstance(
137 	const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > & rSMgr)
138 	throw ( com::sun::star::uno::Exception );
139 
140 #endif
141 
142 
143 
144