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