1*cdf0e10cSrcweir /*************************************************************************
2*cdf0e10cSrcweir  *
3*cdf0e10cSrcweir  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir  *
5*cdf0e10cSrcweir  * Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir  *
7*cdf0e10cSrcweir  * OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir  *
9*cdf0e10cSrcweir  * This file is part of OpenOffice.org.
10*cdf0e10cSrcweir  *
11*cdf0e10cSrcweir  * OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir  * it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir  * only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir  *
15*cdf0e10cSrcweir  * OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir  * GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir  * (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir  *
21*cdf0e10cSrcweir  * You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir  * version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir  * <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir  * for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir  *
26*cdf0e10cSrcweir  ************************************************************************/
27*cdf0e10cSrcweir 
28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
29*cdf0e10cSrcweir #include "precompiled_xmlsecurity.hxx"
30*cdf0e10cSrcweir #include <sal/config.h>
31*cdf0e10cSrcweir #include <rtl/uuid.h>
32*cdf0e10cSrcweir #include "xmlsignature_nssimpl.hxx"
33*cdf0e10cSrcweir 
34*cdf0e10cSrcweir #ifndef _XMLDOCUMENTWRAPPER_XMLSECIMPL_HXX_
35*cdf0e10cSrcweir #include "xmldocumentwrapper_xmlsecimpl.hxx"
36*cdf0e10cSrcweir #endif
37*cdf0e10cSrcweir 
38*cdf0e10cSrcweir #ifndef _XMLELEMENTWRAPPER_XMLSECIMPL_HXX_
39*cdf0e10cSrcweir #include "xmlelementwrapper_xmlsecimpl.hxx"
40*cdf0e10cSrcweir #endif
41*cdf0e10cSrcweir 
42*cdf0e10cSrcweir #ifndef _SECURITYENVIRONMENT_NSSIMPL_HXX_
43*cdf0e10cSrcweir #include "securityenvironment_nssimpl.hxx"
44*cdf0e10cSrcweir #endif
45*cdf0e10cSrcweir 
46*cdf0e10cSrcweir #ifndef _XMLSECURITYCONTEXT_NSSIMPL_HXX_
47*cdf0e10cSrcweir #include "xmlsecuritycontext_nssimpl.hxx"
48*cdf0e10cSrcweir #endif
49*cdf0e10cSrcweir #include "xmlstreamio.hxx"
50*cdf0e10cSrcweir #include "errorcallback.hxx"
51*cdf0e10cSrcweir 
52*cdf0e10cSrcweir #include <sal/types.h>
53*cdf0e10cSrcweir //For reasons that escape me, this is what xmlsec does when size_t is not 4
54*cdf0e10cSrcweir #if SAL_TYPES_SIZEOFPOINTER != 4
55*cdf0e10cSrcweir #    define XMLSEC_NO_SIZE_T
56*cdf0e10cSrcweir #endif
57*cdf0e10cSrcweir #include "xmlsec/xmlsec.h"
58*cdf0e10cSrcweir #include "xmlsec/xmldsig.h"
59*cdf0e10cSrcweir #include "xmlsec/crypto.h"
60*cdf0e10cSrcweir 
61*cdf0e10cSrcweir using namespace ::com::sun::star::uno ;
62*cdf0e10cSrcweir using namespace ::com::sun::star::lang ;
63*cdf0e10cSrcweir using ::com::sun::star::lang::XMultiServiceFactory ;
64*cdf0e10cSrcweir using ::com::sun::star::lang::XSingleServiceFactory ;
65*cdf0e10cSrcweir using ::rtl::OUString ;
66*cdf0e10cSrcweir 
67*cdf0e10cSrcweir using ::com::sun::star::xml::wrapper::XXMLElementWrapper ;
68*cdf0e10cSrcweir using ::com::sun::star::xml::wrapper::XXMLDocumentWrapper ;
69*cdf0e10cSrcweir using ::com::sun::star::xml::crypto::XSecurityEnvironment ;
70*cdf0e10cSrcweir using ::com::sun::star::xml::crypto::XXMLSignature ;
71*cdf0e10cSrcweir using ::com::sun::star::xml::crypto::XXMLSignatureTemplate ;
72*cdf0e10cSrcweir using ::com::sun::star::xml::crypto::XSecurityEnvironment ;
73*cdf0e10cSrcweir using ::com::sun::star::xml::crypto::XXMLSecurityContext ;
74*cdf0e10cSrcweir using ::com::sun::star::xml::crypto::XUriBinding ;
75*cdf0e10cSrcweir using ::com::sun::star::xml::crypto::XMLSignatureException ;
76*cdf0e10cSrcweir 
77*cdf0e10cSrcweir XMLSignature_NssImpl :: XMLSignature_NssImpl( const Reference< XMultiServiceFactory >& aFactory ) : m_xServiceManager( aFactory ) {
78*cdf0e10cSrcweir }
79*cdf0e10cSrcweir 
80*cdf0e10cSrcweir XMLSignature_NssImpl :: ~XMLSignature_NssImpl() {
81*cdf0e10cSrcweir }
82*cdf0e10cSrcweir 
83*cdf0e10cSrcweir /* XXMLSignature */
84*cdf0e10cSrcweir Reference< XXMLSignatureTemplate >
85*cdf0e10cSrcweir SAL_CALL XMLSignature_NssImpl :: generate(
86*cdf0e10cSrcweir 	const Reference< XXMLSignatureTemplate >& aTemplate ,
87*cdf0e10cSrcweir 	const Reference< XSecurityEnvironment >& aEnvironment
88*cdf0e10cSrcweir ) throw( com::sun::star::xml::crypto::XMLSignatureException,
89*cdf0e10cSrcweir 		 com::sun::star::uno::SecurityException )
90*cdf0e10cSrcweir {
91*cdf0e10cSrcweir 	xmlSecKeysMngrPtr pMngr = NULL ;
92*cdf0e10cSrcweir 	xmlSecDSigCtxPtr pDsigCtx = NULL ;
93*cdf0e10cSrcweir 	xmlNodePtr pNode = NULL ;
94*cdf0e10cSrcweir 
95*cdf0e10cSrcweir 	if( !aTemplate.is() )
96*cdf0e10cSrcweir 		throw RuntimeException() ;
97*cdf0e10cSrcweir 
98*cdf0e10cSrcweir 	if( !aEnvironment.is() )
99*cdf0e10cSrcweir 		throw RuntimeException() ;
100*cdf0e10cSrcweir 
101*cdf0e10cSrcweir 	//Get the xml node
102*cdf0e10cSrcweir 	Reference< XXMLElementWrapper > xElement = aTemplate->getTemplate() ;
103*cdf0e10cSrcweir 	if( !xElement.is() ) {
104*cdf0e10cSrcweir 		throw RuntimeException() ;
105*cdf0e10cSrcweir 	}
106*cdf0e10cSrcweir 
107*cdf0e10cSrcweir 	Reference< XUnoTunnel > xNodTunnel( xElement , UNO_QUERY ) ;
108*cdf0e10cSrcweir 	if( !xNodTunnel.is() ) {
109*cdf0e10cSrcweir 		throw RuntimeException() ;
110*cdf0e10cSrcweir 	}
111*cdf0e10cSrcweir 
112*cdf0e10cSrcweir 	XMLElementWrapper_XmlSecImpl* pElement =
113*cdf0e10cSrcweir         reinterpret_cast<XMLElementWrapper_XmlSecImpl*>(
114*cdf0e10cSrcweir             sal::static_int_cast<sal_uIntPtr>(
115*cdf0e10cSrcweir                 xNodTunnel->getSomething( XMLElementWrapper_XmlSecImpl::getUnoTunnelImplementationId() )));
116*cdf0e10cSrcweir 	if( pElement == NULL ) {
117*cdf0e10cSrcweir 		throw RuntimeException() ;
118*cdf0e10cSrcweir 	}
119*cdf0e10cSrcweir 
120*cdf0e10cSrcweir 	pNode = pElement->getNativeElement() ;
121*cdf0e10cSrcweir 
122*cdf0e10cSrcweir 	//Get the stream/URI binding
123*cdf0e10cSrcweir 	Reference< XUriBinding > xUriBinding = aTemplate->getBinding() ;
124*cdf0e10cSrcweir 	if( xUriBinding.is() ) {
125*cdf0e10cSrcweir 		//Register the stream input callbacks into libxml2
126*cdf0e10cSrcweir 		if( xmlRegisterStreamInputCallbacks( xUriBinding ) < 0 )
127*cdf0e10cSrcweir 			throw RuntimeException() ;
128*cdf0e10cSrcweir 	}
129*cdf0e10cSrcweir 
130*cdf0e10cSrcweir 	//Get Keys Manager
131*cdf0e10cSrcweir 	Reference< XUnoTunnel > xSecTunnel( aEnvironment , UNO_QUERY ) ;
132*cdf0e10cSrcweir 	if( !xSecTunnel.is() ) {
133*cdf0e10cSrcweir 		 throw RuntimeException() ;
134*cdf0e10cSrcweir 	}
135*cdf0e10cSrcweir 
136*cdf0e10cSrcweir #if 0 //i39448 : the key manager should be retrieved from SecurityEnvironment, instead of SecurityContext
137*cdf0e10cSrcweir 	XMLSecurityContext_NssImpl* pSecCtxt = ( XMLSecurityContext_NssImpl* )xSecTunnel->getSomething( XMLSecurityContext_NssImpl::getUnoTunnelId() ) ;
138*cdf0e10cSrcweir 	if( pSecCtxt == NULL )
139*cdf0e10cSrcweir 		throw RuntimeException() ;
140*cdf0e10cSrcweir #endif
141*cdf0e10cSrcweir 
142*cdf0e10cSrcweir 	SecurityEnvironment_NssImpl* pSecEnv =
143*cdf0e10cSrcweir         reinterpret_cast<SecurityEnvironment_NssImpl*>(
144*cdf0e10cSrcweir             sal::static_int_cast<sal_uIntPtr>(
145*cdf0e10cSrcweir                 xSecTunnel->getSomething( SecurityEnvironment_NssImpl::getUnoTunnelId() )));
146*cdf0e10cSrcweir 	if( pSecEnv == NULL )
147*cdf0e10cSrcweir 		throw RuntimeException() ;
148*cdf0e10cSrcweir 
149*cdf0e10cSrcweir  	setErrorRecorder();
150*cdf0e10cSrcweir 
151*cdf0e10cSrcweir 	pMngr = pSecEnv->createKeysManager() ; //i39448
152*cdf0e10cSrcweir 	if( !pMngr ) {
153*cdf0e10cSrcweir 		throw RuntimeException() ;
154*cdf0e10cSrcweir 	}
155*cdf0e10cSrcweir 
156*cdf0e10cSrcweir 	//Create Signature context
157*cdf0e10cSrcweir 	pDsigCtx = xmlSecDSigCtxCreate( pMngr ) ;
158*cdf0e10cSrcweir 	if( pDsigCtx == NULL )
159*cdf0e10cSrcweir 	{
160*cdf0e10cSrcweir 		pSecEnv->destroyKeysManager( pMngr ) ; //i39448
161*cdf0e10cSrcweir 		//throw XMLSignatureException() ;
162*cdf0e10cSrcweir 		clearErrorRecorder();
163*cdf0e10cSrcweir 		return aTemplate;
164*cdf0e10cSrcweir 	}
165*cdf0e10cSrcweir 
166*cdf0e10cSrcweir 	//Sign the template
167*cdf0e10cSrcweir 	if( xmlSecDSigCtxSign( pDsigCtx , pNode ) == 0 )
168*cdf0e10cSrcweir 	{
169*cdf0e10cSrcweir         if (pDsigCtx->status == xmlSecDSigStatusSucceeded)
170*cdf0e10cSrcweir             aTemplate->setStatus(com::sun::star::xml::crypto::SecurityOperationStatus_OPERATION_SUCCEEDED);
171*cdf0e10cSrcweir         else
172*cdf0e10cSrcweir             aTemplate->setStatus(com::sun::star::xml::crypto::SecurityOperationStatus_UNKNOWN);
173*cdf0e10cSrcweir 	}
174*cdf0e10cSrcweir     else
175*cdf0e10cSrcweir 	{
176*cdf0e10cSrcweir         aTemplate->setStatus(com::sun::star::xml::crypto::SecurityOperationStatus_UNKNOWN);
177*cdf0e10cSrcweir 	}
178*cdf0e10cSrcweir 
179*cdf0e10cSrcweir 
180*cdf0e10cSrcweir 	xmlSecDSigCtxDestroy( pDsigCtx ) ;
181*cdf0e10cSrcweir 	pSecEnv->destroyKeysManager( pMngr ) ; //i39448
182*cdf0e10cSrcweir 
183*cdf0e10cSrcweir 	//Unregistered the stream/URI binding
184*cdf0e10cSrcweir 	if( xUriBinding.is() )
185*cdf0e10cSrcweir 		xmlUnregisterStreamInputCallbacks() ;
186*cdf0e10cSrcweir 
187*cdf0e10cSrcweir 	clearErrorRecorder();
188*cdf0e10cSrcweir 	return aTemplate ;
189*cdf0e10cSrcweir }
190*cdf0e10cSrcweir 
191*cdf0e10cSrcweir /* XXMLSignature */
192*cdf0e10cSrcweir Reference< XXMLSignatureTemplate >
193*cdf0e10cSrcweir SAL_CALL XMLSignature_NssImpl :: validate(
194*cdf0e10cSrcweir 	const Reference< XXMLSignatureTemplate >& aTemplate ,
195*cdf0e10cSrcweir 	const Reference< XXMLSecurityContext >& aSecurityCtx
196*cdf0e10cSrcweir ) throw( com::sun::star::uno::RuntimeException,
197*cdf0e10cSrcweir 		 com::sun::star::uno::SecurityException,
198*cdf0e10cSrcweir 		 com::sun::star::xml::crypto::XMLSignatureException ) {
199*cdf0e10cSrcweir 	xmlSecKeysMngrPtr pMngr = NULL ;
200*cdf0e10cSrcweir 	xmlSecDSigCtxPtr pDsigCtx = NULL ;
201*cdf0e10cSrcweir 	xmlNodePtr pNode = NULL ;
202*cdf0e10cSrcweir 	//sal_Bool valid ;
203*cdf0e10cSrcweir 
204*cdf0e10cSrcweir 	if( !aTemplate.is() )
205*cdf0e10cSrcweir 		throw RuntimeException() ;
206*cdf0e10cSrcweir 
207*cdf0e10cSrcweir 	if( !aSecurityCtx.is() )
208*cdf0e10cSrcweir 		throw RuntimeException() ;
209*cdf0e10cSrcweir 
210*cdf0e10cSrcweir 	//Get the xml node
211*cdf0e10cSrcweir 	Reference< XXMLElementWrapper > xElement = aTemplate->getTemplate() ;
212*cdf0e10cSrcweir 	if( !xElement.is() )
213*cdf0e10cSrcweir 		throw RuntimeException() ;
214*cdf0e10cSrcweir 
215*cdf0e10cSrcweir 	Reference< XUnoTunnel > xNodTunnel( xElement , UNO_QUERY ) ;
216*cdf0e10cSrcweir 	if( !xNodTunnel.is() ) {
217*cdf0e10cSrcweir 		throw RuntimeException() ;
218*cdf0e10cSrcweir 	}
219*cdf0e10cSrcweir 
220*cdf0e10cSrcweir 	XMLElementWrapper_XmlSecImpl* pElement =
221*cdf0e10cSrcweir         reinterpret_cast<XMLElementWrapper_XmlSecImpl*>(
222*cdf0e10cSrcweir             sal::static_int_cast<sal_uIntPtr>(
223*cdf0e10cSrcweir                 xNodTunnel->getSomething( XMLElementWrapper_XmlSecImpl::getUnoTunnelImplementationId() )));
224*cdf0e10cSrcweir 	if( pElement == NULL )
225*cdf0e10cSrcweir 		throw RuntimeException() ;
226*cdf0e10cSrcweir 
227*cdf0e10cSrcweir 	pNode = pElement->getNativeElement() ;
228*cdf0e10cSrcweir 
229*cdf0e10cSrcweir 	//Get the stream/URI binding
230*cdf0e10cSrcweir 	Reference< XUriBinding > xUriBinding = aTemplate->getBinding() ;
231*cdf0e10cSrcweir 	if( xUriBinding.is() ) {
232*cdf0e10cSrcweir 		//Register the stream input callbacks into libxml2
233*cdf0e10cSrcweir 		if( xmlRegisterStreamInputCallbacks( xUriBinding ) < 0 )
234*cdf0e10cSrcweir 			throw RuntimeException() ;
235*cdf0e10cSrcweir 	}
236*cdf0e10cSrcweir 
237*cdf0e10cSrcweir  	setErrorRecorder();
238*cdf0e10cSrcweir 
239*cdf0e10cSrcweir 	sal_Int32 nSecurityEnvironment = aSecurityCtx->getSecurityEnvironmentNumber();
240*cdf0e10cSrcweir 	sal_Int32 i;
241*cdf0e10cSrcweir 
242*cdf0e10cSrcweir 	for (i=0; i<nSecurityEnvironment; ++i)
243*cdf0e10cSrcweir 	{
244*cdf0e10cSrcweir 		Reference< XSecurityEnvironment > aEnvironment = aSecurityCtx->getSecurityEnvironmentByIndex(i);
245*cdf0e10cSrcweir 
246*cdf0e10cSrcweir 		//Get Keys Manager
247*cdf0e10cSrcweir 		Reference< XUnoTunnel > xSecTunnel( aEnvironment , UNO_QUERY ) ;
248*cdf0e10cSrcweir 		if( !xSecTunnel.is() ) {
249*cdf0e10cSrcweir 			 throw RuntimeException() ;
250*cdf0e10cSrcweir 		}
251*cdf0e10cSrcweir 
252*cdf0e10cSrcweir 		SecurityEnvironment_NssImpl* pSecEnv =
253*cdf0e10cSrcweir             reinterpret_cast<SecurityEnvironment_NssImpl*>(
254*cdf0e10cSrcweir                 sal::static_int_cast<sal_uIntPtr>(
255*cdf0e10cSrcweir                     xSecTunnel->getSomething( SecurityEnvironment_NssImpl::getUnoTunnelId() )));
256*cdf0e10cSrcweir 		if( pSecEnv == NULL )
257*cdf0e10cSrcweir 			throw RuntimeException() ;
258*cdf0e10cSrcweir 
259*cdf0e10cSrcweir 		pMngr = pSecEnv->createKeysManager() ; //i39448
260*cdf0e10cSrcweir 		if( !pMngr ) {
261*cdf0e10cSrcweir 			throw RuntimeException() ;
262*cdf0e10cSrcweir 		}
263*cdf0e10cSrcweir 
264*cdf0e10cSrcweir 		//Create Signature context
265*cdf0e10cSrcweir 		pDsigCtx = xmlSecDSigCtxCreate( pMngr ) ;
266*cdf0e10cSrcweir 		if( pDsigCtx == NULL )
267*cdf0e10cSrcweir 		{
268*cdf0e10cSrcweir 			pSecEnv->destroyKeysManager( pMngr ) ; //i39448
269*cdf0e10cSrcweir 			//throw XMLSignatureException() ;
270*cdf0e10cSrcweir 			clearErrorRecorder();
271*cdf0e10cSrcweir 			return aTemplate;
272*cdf0e10cSrcweir 		}
273*cdf0e10cSrcweir 
274*cdf0e10cSrcweir 		//Verify signature
275*cdf0e10cSrcweir 		int rs = xmlSecDSigCtxVerify( pDsigCtx , pNode );
276*cdf0e10cSrcweir 
277*cdf0e10cSrcweir 
278*cdf0e10cSrcweir 		if (rs == 0 &&
279*cdf0e10cSrcweir             pDsigCtx->status == xmlSecDSigStatusSucceeded)
280*cdf0e10cSrcweir 		{
281*cdf0e10cSrcweir             aTemplate->setStatus(com::sun::star::xml::crypto::SecurityOperationStatus_OPERATION_SUCCEEDED);
282*cdf0e10cSrcweir             xmlSecDSigCtxDestroy( pDsigCtx ) ;
283*cdf0e10cSrcweir             pSecEnv->destroyKeysManager( pMngr );
284*cdf0e10cSrcweir 			break;
285*cdf0e10cSrcweir 		}
286*cdf0e10cSrcweir         else
287*cdf0e10cSrcweir         {
288*cdf0e10cSrcweir             aTemplate->setStatus(com::sun::star::xml::crypto::SecurityOperationStatus_UNKNOWN);
289*cdf0e10cSrcweir         }
290*cdf0e10cSrcweir         xmlSecDSigCtxDestroy( pDsigCtx ) ;
291*cdf0e10cSrcweir 		pSecEnv->destroyKeysManager( pMngr );
292*cdf0e10cSrcweir 	}
293*cdf0e10cSrcweir 
294*cdf0e10cSrcweir 
295*cdf0e10cSrcweir 
296*cdf0e10cSrcweir 	//Unregistered the stream/URI binding
297*cdf0e10cSrcweir 	if( xUriBinding.is() )
298*cdf0e10cSrcweir 		xmlUnregisterStreamInputCallbacks() ;
299*cdf0e10cSrcweir 
300*cdf0e10cSrcweir 	//return valid ;
301*cdf0e10cSrcweir 	clearErrorRecorder();
302*cdf0e10cSrcweir 	return aTemplate;
303*cdf0e10cSrcweir }
304*cdf0e10cSrcweir 
305*cdf0e10cSrcweir /* XInitialization */
306*cdf0e10cSrcweir void SAL_CALL XMLSignature_NssImpl :: initialize( const Sequence< Any >& /*aArguments*/ ) throw( Exception, RuntimeException ) {
307*cdf0e10cSrcweir 	// TBD
308*cdf0e10cSrcweir } ;
309*cdf0e10cSrcweir 
310*cdf0e10cSrcweir /* XServiceInfo */
311*cdf0e10cSrcweir OUString SAL_CALL XMLSignature_NssImpl :: getImplementationName() throw( RuntimeException ) {
312*cdf0e10cSrcweir 	return impl_getImplementationName() ;
313*cdf0e10cSrcweir }
314*cdf0e10cSrcweir 
315*cdf0e10cSrcweir /* XServiceInfo */
316*cdf0e10cSrcweir sal_Bool SAL_CALL XMLSignature_NssImpl :: supportsService( const OUString& serviceName) throw( RuntimeException ) {
317*cdf0e10cSrcweir 	Sequence< OUString > seqServiceNames = getSupportedServiceNames() ;
318*cdf0e10cSrcweir 	const OUString* pArray = seqServiceNames.getConstArray() ;
319*cdf0e10cSrcweir 	for( sal_Int32 i = 0 ; i < seqServiceNames.getLength() ; i ++ ) {
320*cdf0e10cSrcweir 		if( *( pArray + i ) == serviceName )
321*cdf0e10cSrcweir 			return sal_True ;
322*cdf0e10cSrcweir 	}
323*cdf0e10cSrcweir 	return sal_False ;
324*cdf0e10cSrcweir }
325*cdf0e10cSrcweir 
326*cdf0e10cSrcweir /* XServiceInfo */
327*cdf0e10cSrcweir Sequence< OUString > SAL_CALL XMLSignature_NssImpl :: getSupportedServiceNames() throw( RuntimeException ) {
328*cdf0e10cSrcweir 	return impl_getSupportedServiceNames() ;
329*cdf0e10cSrcweir }
330*cdf0e10cSrcweir 
331*cdf0e10cSrcweir //Helper for XServiceInfo
332*cdf0e10cSrcweir Sequence< OUString > XMLSignature_NssImpl :: impl_getSupportedServiceNames() {
333*cdf0e10cSrcweir 	::osl::Guard< ::osl::Mutex > aGuard( ::osl::Mutex::getGlobalMutex() ) ;
334*cdf0e10cSrcweir 	Sequence< OUString > seqServiceNames( 1 ) ;
335*cdf0e10cSrcweir 	seqServiceNames.getArray()[0] = OUString::createFromAscii( "com.sun.star.xml.crypto.XMLSignature" ) ;
336*cdf0e10cSrcweir 	return seqServiceNames ;
337*cdf0e10cSrcweir }
338*cdf0e10cSrcweir 
339*cdf0e10cSrcweir OUString XMLSignature_NssImpl :: impl_getImplementationName() throw( RuntimeException ) {
340*cdf0e10cSrcweir 	return OUString::createFromAscii( "com.sun.star.xml.security.bridge.xmlsec.XMLSignature_NssImpl" ) ;
341*cdf0e10cSrcweir }
342*cdf0e10cSrcweir 
343*cdf0e10cSrcweir //Helper for registry
344*cdf0e10cSrcweir Reference< XInterface > SAL_CALL XMLSignature_NssImpl :: impl_createInstance( const Reference< XMultiServiceFactory >& aServiceManager ) throw( RuntimeException ) {
345*cdf0e10cSrcweir 	return Reference< XInterface >( *new XMLSignature_NssImpl( aServiceManager ) ) ;
346*cdf0e10cSrcweir }
347*cdf0e10cSrcweir 
348*cdf0e10cSrcweir Reference< XSingleServiceFactory > XMLSignature_NssImpl :: impl_createFactory( const Reference< XMultiServiceFactory >& aServiceManager ) {
349*cdf0e10cSrcweir 	//Reference< XSingleServiceFactory > xFactory ;
350*cdf0e10cSrcweir 	//xFactory = ::cppu::createSingleFactory( aServiceManager , impl_getImplementationName , impl_createInstance , impl_getSupportedServiceNames ) ;
351*cdf0e10cSrcweir 	//return xFactory ;
352*cdf0e10cSrcweir 	return ::cppu::createSingleFactory( aServiceManager , impl_getImplementationName() , impl_createInstance , impl_getSupportedServiceNames() ) ;
353*cdf0e10cSrcweir }
354*cdf0e10cSrcweir 
355