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 
33*cdf0e10cSrcweir #include "com/sun/star/xml/crypto/SecurityOperationStatus.hdl"
34*cdf0e10cSrcweir #include "xmlsignature_mscryptimpl.hxx"
35*cdf0e10cSrcweir 
36*cdf0e10cSrcweir #ifndef _XMLDOCUMENTWRAPPER_XMLSECIMPL_HXX_
37*cdf0e10cSrcweir #include "xmldocumentwrapper_xmlsecimpl.hxx"
38*cdf0e10cSrcweir #endif
39*cdf0e10cSrcweir 
40*cdf0e10cSrcweir #ifndef _XMLELEMENTWRAPPER_XMLSECIMPL_HXX_
41*cdf0e10cSrcweir #include "xmlelementwrapper_xmlsecimpl.hxx"
42*cdf0e10cSrcweir #endif
43*cdf0e10cSrcweir 
44*cdf0e10cSrcweir #ifndef _SECURITYENVIRONMENT_MSCRYPTIMPL_HXX_
45*cdf0e10cSrcweir #include "securityenvironment_mscryptimpl.hxx"
46*cdf0e10cSrcweir #endif
47*cdf0e10cSrcweir #include "xmlstreamio.hxx"
48*cdf0e10cSrcweir #include "errorcallback.hxx"
49*cdf0e10cSrcweir 
50*cdf0e10cSrcweir #include "xmlsec/xmlsec.h"
51*cdf0e10cSrcweir #include "xmlsec/xmldsig.h"
52*cdf0e10cSrcweir #include "xmlsec/crypto.h"
53*cdf0e10cSrcweir 
54*cdf0e10cSrcweir using namespace ::com::sun::star::uno ;
55*cdf0e10cSrcweir using namespace ::com::sun::star::lang ;
56*cdf0e10cSrcweir using ::com::sun::star::lang::XMultiServiceFactory ;
57*cdf0e10cSrcweir using ::com::sun::star::lang::XSingleServiceFactory ;
58*cdf0e10cSrcweir using ::rtl::OUString ;
59*cdf0e10cSrcweir 
60*cdf0e10cSrcweir using ::com::sun::star::xml::wrapper::XXMLElementWrapper ;
61*cdf0e10cSrcweir using ::com::sun::star::xml::wrapper::XXMLDocumentWrapper ;
62*cdf0e10cSrcweir using ::com::sun::star::xml::crypto::XSecurityEnvironment ;
63*cdf0e10cSrcweir using ::com::sun::star::xml::crypto::XXMLSignature ;
64*cdf0e10cSrcweir using ::com::sun::star::xml::crypto::XXMLSignatureTemplate ;
65*cdf0e10cSrcweir using ::com::sun::star::xml::crypto::XXMLSecurityContext ;
66*cdf0e10cSrcweir using ::com::sun::star::xml::crypto::XUriBinding ;
67*cdf0e10cSrcweir using ::com::sun::star::xml::crypto::XMLSignatureException ;
68*cdf0e10cSrcweir 
69*cdf0e10cSrcweir 
70*cdf0e10cSrcweir XMLSignature_MSCryptImpl :: XMLSignature_MSCryptImpl( const Reference< XMultiServiceFactory >& aFactory ) : m_xServiceManager( aFactory ) {
71*cdf0e10cSrcweir }
72*cdf0e10cSrcweir 
73*cdf0e10cSrcweir XMLSignature_MSCryptImpl :: ~XMLSignature_MSCryptImpl() {
74*cdf0e10cSrcweir }
75*cdf0e10cSrcweir 
76*cdf0e10cSrcweir /* XXMLSignature */
77*cdf0e10cSrcweir Reference< XXMLSignatureTemplate >
78*cdf0e10cSrcweir SAL_CALL XMLSignature_MSCryptImpl :: generate(
79*cdf0e10cSrcweir 	const Reference< XXMLSignatureTemplate >& aTemplate ,
80*cdf0e10cSrcweir 	const Reference< XSecurityEnvironment >& aEnvironment
81*cdf0e10cSrcweir ) throw( com::sun::star::xml::crypto::XMLSignatureException,
82*cdf0e10cSrcweir 		 com::sun::star::uno::SecurityException )
83*cdf0e10cSrcweir {
84*cdf0e10cSrcweir 	xmlSecKeysMngrPtr pMngr = NULL ;
85*cdf0e10cSrcweir 	xmlSecDSigCtxPtr pDsigCtx = NULL ;
86*cdf0e10cSrcweir 	xmlNodePtr pNode = NULL ;
87*cdf0e10cSrcweir 
88*cdf0e10cSrcweir 	if( !aTemplate.is() )
89*cdf0e10cSrcweir 		throw RuntimeException() ;
90*cdf0e10cSrcweir 
91*cdf0e10cSrcweir 	if( !aEnvironment.is() )
92*cdf0e10cSrcweir 		throw RuntimeException() ;
93*cdf0e10cSrcweir 
94*cdf0e10cSrcweir 	//Get Keys Manager
95*cdf0e10cSrcweir 	Reference< XUnoTunnel > xSecTunnel( aEnvironment , UNO_QUERY ) ;
96*cdf0e10cSrcweir 	if( !xSecTunnel.is() ) {
97*cdf0e10cSrcweir 		 throw RuntimeException() ;
98*cdf0e10cSrcweir 	}
99*cdf0e10cSrcweir 
100*cdf0e10cSrcweir 	SecurityEnvironment_MSCryptImpl* pSecEnv = ( SecurityEnvironment_MSCryptImpl* )xSecTunnel->getSomething( SecurityEnvironment_MSCryptImpl::getUnoTunnelId() ) ;
101*cdf0e10cSrcweir 	if( pSecEnv == NULL )
102*cdf0e10cSrcweir 		throw RuntimeException() ;
103*cdf0e10cSrcweir 
104*cdf0e10cSrcweir 	//Get the xml node
105*cdf0e10cSrcweir 	Reference< XXMLElementWrapper > xElement = aTemplate->getTemplate() ;
106*cdf0e10cSrcweir 	if( !xElement.is() ) {
107*cdf0e10cSrcweir 		throw RuntimeException() ;
108*cdf0e10cSrcweir 	}
109*cdf0e10cSrcweir 
110*cdf0e10cSrcweir 	Reference< XUnoTunnel > xNodTunnel( xElement , UNO_QUERY ) ;
111*cdf0e10cSrcweir 	if( !xNodTunnel.is() ) {
112*cdf0e10cSrcweir 		throw RuntimeException() ;
113*cdf0e10cSrcweir 	}
114*cdf0e10cSrcweir 
115*cdf0e10cSrcweir 	XMLElementWrapper_XmlSecImpl* pElement = ( XMLElementWrapper_XmlSecImpl* )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  	setErrorRecorder( );
131*cdf0e10cSrcweir 
132*cdf0e10cSrcweir 	pMngr = pSecEnv->createKeysManager() ; //i39448
133*cdf0e10cSrcweir 	if( !pMngr ) {
134*cdf0e10cSrcweir 		throw RuntimeException() ;
135*cdf0e10cSrcweir 	}
136*cdf0e10cSrcweir 
137*cdf0e10cSrcweir 	//Create Signature context
138*cdf0e10cSrcweir 	pDsigCtx = xmlSecDSigCtxCreate( pMngr ) ;
139*cdf0e10cSrcweir 	if( pDsigCtx == NULL )
140*cdf0e10cSrcweir 	{
141*cdf0e10cSrcweir 		//throw XMLSignatureException() ;
142*cdf0e10cSrcweir 		pSecEnv->destroyKeysManager( pMngr ) ; //i39448
143*cdf0e10cSrcweir 		clearErrorRecorder();
144*cdf0e10cSrcweir 		return aTemplate;
145*cdf0e10cSrcweir 	}
146*cdf0e10cSrcweir 
147*cdf0e10cSrcweir 	//Sign the template
148*cdf0e10cSrcweir 	if( xmlSecDSigCtxSign( pDsigCtx , pNode ) == 0 )
149*cdf0e10cSrcweir 	{
150*cdf0e10cSrcweir         if (pDsigCtx->status == xmlSecDSigStatusSucceeded)
151*cdf0e10cSrcweir             aTemplate->setStatus(com::sun::star::xml::crypto::SecurityOperationStatus_OPERATION_SUCCEEDED);
152*cdf0e10cSrcweir         else
153*cdf0e10cSrcweir             aTemplate->setStatus(com::sun::star::xml::crypto::SecurityOperationStatus_UNKNOWN);
154*cdf0e10cSrcweir 	}
155*cdf0e10cSrcweir     else
156*cdf0e10cSrcweir 	{
157*cdf0e10cSrcweir         aTemplate->setStatus(com::sun::star::xml::crypto::SecurityOperationStatus_UNKNOWN);
158*cdf0e10cSrcweir 	}
159*cdf0e10cSrcweir 
160*cdf0e10cSrcweir 
161*cdf0e10cSrcweir 	xmlSecDSigCtxDestroy( pDsigCtx ) ;
162*cdf0e10cSrcweir 	pSecEnv->destroyKeysManager( pMngr ) ; //i39448
163*cdf0e10cSrcweir 
164*cdf0e10cSrcweir 	//Unregistered the stream/URI binding
165*cdf0e10cSrcweir 	if( xUriBinding.is() )
166*cdf0e10cSrcweir 		xmlUnregisterStreamInputCallbacks() ;
167*cdf0e10cSrcweir 
168*cdf0e10cSrcweir 	clearErrorRecorder();
169*cdf0e10cSrcweir 	return aTemplate ;
170*cdf0e10cSrcweir }
171*cdf0e10cSrcweir 
172*cdf0e10cSrcweir /* XXMLSignature */
173*cdf0e10cSrcweir Reference< XXMLSignatureTemplate >
174*cdf0e10cSrcweir SAL_CALL XMLSignature_MSCryptImpl :: validate(
175*cdf0e10cSrcweir 	const Reference< XXMLSignatureTemplate >& aTemplate ,
176*cdf0e10cSrcweir 	const Reference< XXMLSecurityContext >& aSecurityCtx
177*cdf0e10cSrcweir ) throw( com::sun::star::uno::RuntimeException,
178*cdf0e10cSrcweir 		 com::sun::star::uno::SecurityException,
179*cdf0e10cSrcweir 		 com::sun::star::xml::crypto::XMLSignatureException ) {
180*cdf0e10cSrcweir 	xmlSecKeysMngrPtr pMngr = NULL ;
181*cdf0e10cSrcweir 	xmlSecDSigCtxPtr pDsigCtx = NULL ;
182*cdf0e10cSrcweir 	xmlNodePtr pNode = NULL ;
183*cdf0e10cSrcweir 	//sal_Bool valid ;
184*cdf0e10cSrcweir 
185*cdf0e10cSrcweir 	if( !aTemplate.is() )
186*cdf0e10cSrcweir 		throw RuntimeException() ;
187*cdf0e10cSrcweir 
188*cdf0e10cSrcweir 	if( !aSecurityCtx.is() )
189*cdf0e10cSrcweir 		throw RuntimeException() ;
190*cdf0e10cSrcweir 
191*cdf0e10cSrcweir 	//Get Keys Manager
192*cdf0e10cSrcweir 	Reference< XSecurityEnvironment > xSecEnv
193*cdf0e10cSrcweir 		= aSecurityCtx->getSecurityEnvironmentByIndex(
194*cdf0e10cSrcweir 			aSecurityCtx->getDefaultSecurityEnvironmentIndex());
195*cdf0e10cSrcweir 	Reference< XUnoTunnel > xSecTunnel( xSecEnv , UNO_QUERY ) ;
196*cdf0e10cSrcweir 	if( !xSecTunnel.is() ) {
197*cdf0e10cSrcweir 		 throw RuntimeException() ;
198*cdf0e10cSrcweir 	}
199*cdf0e10cSrcweir 
200*cdf0e10cSrcweir 	SecurityEnvironment_MSCryptImpl* pSecEnv = ( SecurityEnvironment_MSCryptImpl* )xSecTunnel->getSomething( SecurityEnvironment_MSCryptImpl::getUnoTunnelId() ) ;
201*cdf0e10cSrcweir 	if( pSecEnv == NULL )
202*cdf0e10cSrcweir 		throw RuntimeException() ;
203*cdf0e10cSrcweir 
204*cdf0e10cSrcweir 	//Get the xml node
205*cdf0e10cSrcweir 	Reference< XXMLElementWrapper > xElement = aTemplate->getTemplate() ;
206*cdf0e10cSrcweir 	if( !xElement.is() )
207*cdf0e10cSrcweir 		throw RuntimeException() ;
208*cdf0e10cSrcweir 
209*cdf0e10cSrcweir 	Reference< XUnoTunnel > xNodTunnel( xElement , UNO_QUERY ) ;
210*cdf0e10cSrcweir 	if( !xNodTunnel.is() ) {
211*cdf0e10cSrcweir 		throw RuntimeException() ;
212*cdf0e10cSrcweir 	}
213*cdf0e10cSrcweir 
214*cdf0e10cSrcweir 	XMLElementWrapper_XmlSecImpl* pElement = ( XMLElementWrapper_XmlSecImpl* )xNodTunnel->getSomething( XMLElementWrapper_XmlSecImpl::getUnoTunnelImplementationId() ) ;
215*cdf0e10cSrcweir 	if( pElement == NULL )
216*cdf0e10cSrcweir 		throw RuntimeException() ;
217*cdf0e10cSrcweir 
218*cdf0e10cSrcweir 	pNode = pElement->getNativeElement() ;
219*cdf0e10cSrcweir 
220*cdf0e10cSrcweir 	//Get the stream/URI binding
221*cdf0e10cSrcweir 	Reference< XUriBinding > xUriBinding = aTemplate->getBinding() ;
222*cdf0e10cSrcweir 	if( xUriBinding.is() ) {
223*cdf0e10cSrcweir 		//Register the stream input callbacks into libxml2
224*cdf0e10cSrcweir 		if( xmlRegisterStreamInputCallbacks( xUriBinding ) < 0 )
225*cdf0e10cSrcweir 			throw RuntimeException() ;
226*cdf0e10cSrcweir 	}
227*cdf0e10cSrcweir 
228*cdf0e10cSrcweir 	//added for test: save the result
229*cdf0e10cSrcweir 	/*
230*cdf0e10cSrcweir 	{
231*cdf0e10cSrcweir 		FILE *dstFile = fopen( "c:\\1.txt", "w" ) ;
232*cdf0e10cSrcweir 		xmlDocDump( dstFile, pNode->doc) ;
233*cdf0e10cSrcweir 		fclose( dstFile ) ;
234*cdf0e10cSrcweir 	}
235*cdf0e10cSrcweir 	*/
236*cdf0e10cSrcweir 
237*cdf0e10cSrcweir  	setErrorRecorder( );
238*cdf0e10cSrcweir 
239*cdf0e10cSrcweir 	pMngr = pSecEnv->createKeysManager() ; //i39448
240*cdf0e10cSrcweir 	if( !pMngr ) {
241*cdf0e10cSrcweir 		throw RuntimeException() ;
242*cdf0e10cSrcweir 	}
243*cdf0e10cSrcweir 
244*cdf0e10cSrcweir 	//Create Signature context
245*cdf0e10cSrcweir 	pDsigCtx = xmlSecDSigCtxCreate( pMngr ) ;
246*cdf0e10cSrcweir 	if( pDsigCtx == NULL )
247*cdf0e10cSrcweir 	{
248*cdf0e10cSrcweir 		pSecEnv->destroyKeysManager( pMngr ) ; //i39448
249*cdf0e10cSrcweir 		//throw XMLSignatureException() ;
250*cdf0e10cSrcweir 		clearErrorRecorder();
251*cdf0e10cSrcweir 		return aTemplate;
252*cdf0e10cSrcweir 	}
253*cdf0e10cSrcweir 
254*cdf0e10cSrcweir 	//Verify signature
255*cdf0e10cSrcweir     //The documentation says that the signature is only valid if the return value is 0 (that is, not < 0)
256*cdf0e10cSrcweir     //AND pDsigCtx->status == xmlSecDSigStatusSucceeded. That is, we must not make any assumptions, if
257*cdf0e10cSrcweir     //the return value is < 0. Then we must regard the signature as INVALID. We cannot use the
258*cdf0e10cSrcweir     //error recorder feature to get the ONE error that made the verification fail, because there is no
259*cdf0e10cSrcweir     //documentation/specification as to how to interpret the number of recorded errors and what is the initial
260*cdf0e10cSrcweir     //error.
261*cdf0e10cSrcweir 	if( xmlSecDSigCtxVerify( pDsigCtx , pNode ) == 0 )
262*cdf0e10cSrcweir     {
263*cdf0e10cSrcweir         if (pDsigCtx->status == xmlSecDSigStatusSucceeded)
264*cdf0e10cSrcweir             aTemplate->setStatus(com::sun::star::xml::crypto::SecurityOperationStatus_OPERATION_SUCCEEDED);
265*cdf0e10cSrcweir         else
266*cdf0e10cSrcweir             aTemplate->setStatus(com::sun::star::xml::crypto::SecurityOperationStatus_UNKNOWN);
267*cdf0e10cSrcweir     }
268*cdf0e10cSrcweir     else
269*cdf0e10cSrcweir     {
270*cdf0e10cSrcweir         aTemplate->setStatus(com::sun::star::xml::crypto::SecurityOperationStatus_UNKNOWN);
271*cdf0e10cSrcweir     }
272*cdf0e10cSrcweir 
273*cdf0e10cSrcweir     xmlSecDSigCtxDestroy( pDsigCtx ) ;
274*cdf0e10cSrcweir     pSecEnv->destroyKeysManager( pMngr ) ; //i39448
275*cdf0e10cSrcweir 
276*cdf0e10cSrcweir     //Unregistered the stream/URI binding
277*cdf0e10cSrcweir     if( xUriBinding.is() )
278*cdf0e10cSrcweir         xmlUnregisterStreamInputCallbacks() ;
279*cdf0e10cSrcweir 
280*cdf0e10cSrcweir 
281*cdf0e10cSrcweir     clearErrorRecorder();
282*cdf0e10cSrcweir     return aTemplate;
283*cdf0e10cSrcweir }
284*cdf0e10cSrcweir 
285*cdf0e10cSrcweir /* XInitialization */
286*cdf0e10cSrcweir void SAL_CALL XMLSignature_MSCryptImpl :: initialize( const Sequence< Any >& /*aArguments*/ ) throw( Exception, RuntimeException ) {
287*cdf0e10cSrcweir 	// TBD
288*cdf0e10cSrcweir } ;
289*cdf0e10cSrcweir 
290*cdf0e10cSrcweir /* XServiceInfo */
291*cdf0e10cSrcweir OUString SAL_CALL XMLSignature_MSCryptImpl :: getImplementationName() throw( RuntimeException ) {
292*cdf0e10cSrcweir 	return impl_getImplementationName() ;
293*cdf0e10cSrcweir }
294*cdf0e10cSrcweir 
295*cdf0e10cSrcweir /* XServiceInfo */
296*cdf0e10cSrcweir sal_Bool SAL_CALL XMLSignature_MSCryptImpl :: supportsService( const OUString& serviceName) throw( RuntimeException ) {
297*cdf0e10cSrcweir 	Sequence< OUString > seqServiceNames = getSupportedServiceNames() ;
298*cdf0e10cSrcweir 	const OUString* pArray = seqServiceNames.getConstArray() ;
299*cdf0e10cSrcweir 	for( sal_Int32 i = 0 ; i < seqServiceNames.getLength() ; i ++ ) {
300*cdf0e10cSrcweir 		if( *( pArray + i ) == serviceName )
301*cdf0e10cSrcweir 			return sal_True ;
302*cdf0e10cSrcweir 	}
303*cdf0e10cSrcweir 	return sal_False ;
304*cdf0e10cSrcweir }
305*cdf0e10cSrcweir 
306*cdf0e10cSrcweir /* XServiceInfo */
307*cdf0e10cSrcweir Sequence< OUString > SAL_CALL XMLSignature_MSCryptImpl :: getSupportedServiceNames() throw( RuntimeException ) {
308*cdf0e10cSrcweir 	return impl_getSupportedServiceNames() ;
309*cdf0e10cSrcweir }
310*cdf0e10cSrcweir 
311*cdf0e10cSrcweir //Helper for XServiceInfo
312*cdf0e10cSrcweir Sequence< OUString > XMLSignature_MSCryptImpl :: impl_getSupportedServiceNames() {
313*cdf0e10cSrcweir 	::osl::Guard< ::osl::Mutex > aGuard( ::osl::Mutex::getGlobalMutex() ) ;
314*cdf0e10cSrcweir 	Sequence< OUString > seqServiceNames( 1 ) ;
315*cdf0e10cSrcweir 	seqServiceNames.getArray()[0] = OUString::createFromAscii( "com.sun.star.xml.crypto.XMLSignature" ) ;
316*cdf0e10cSrcweir 	return seqServiceNames ;
317*cdf0e10cSrcweir }
318*cdf0e10cSrcweir 
319*cdf0e10cSrcweir OUString XMLSignature_MSCryptImpl :: impl_getImplementationName() throw( RuntimeException ) {
320*cdf0e10cSrcweir 	return OUString::createFromAscii( "com.sun.star.xml.security.bridge.xmlsec.XMLSignature_MSCryptImpl" ) ;
321*cdf0e10cSrcweir }
322*cdf0e10cSrcweir 
323*cdf0e10cSrcweir //Helper for registry
324*cdf0e10cSrcweir Reference< XInterface > SAL_CALL XMLSignature_MSCryptImpl :: impl_createInstance( const Reference< XMultiServiceFactory >& aServiceManager ) throw( RuntimeException ) {
325*cdf0e10cSrcweir 	return Reference< XInterface >( *new XMLSignature_MSCryptImpl( aServiceManager ) ) ;
326*cdf0e10cSrcweir }
327*cdf0e10cSrcweir 
328*cdf0e10cSrcweir Reference< XSingleServiceFactory > XMLSignature_MSCryptImpl :: impl_createFactory( const Reference< XMultiServiceFactory >& aServiceManager ) {
329*cdf0e10cSrcweir 	//Reference< XSingleServiceFactory > xFactory ;
330*cdf0e10cSrcweir 	//xFactory = ::cppu::createSingleFactory( aServiceManager , impl_getImplementationName , impl_createInstance , impl_getSupportedServiceNames ) ;
331*cdf0e10cSrcweir 	//return xFactory ;
332*cdf0e10cSrcweir 	return ::cppu::createSingleFactory( aServiceManager , impl_getImplementationName() , impl_createInstance , impl_getSupportedServiceNames() ) ;
333*cdf0e10cSrcweir }
334*cdf0e10cSrcweir 
335