1*b1cdbd2cSJim Jagielski /**************************************************************
2*b1cdbd2cSJim Jagielski *
3*b1cdbd2cSJim Jagielski * Licensed to the Apache Software Foundation (ASF) under one
4*b1cdbd2cSJim Jagielski * or more contributor license agreements. See the NOTICE file
5*b1cdbd2cSJim Jagielski * distributed with this work for additional information
6*b1cdbd2cSJim Jagielski * regarding copyright ownership. The ASF licenses this file
7*b1cdbd2cSJim Jagielski * to you under the Apache License, Version 2.0 (the
8*b1cdbd2cSJim Jagielski * "License"); you may not use this file except in compliance
9*b1cdbd2cSJim Jagielski * with the License. You may obtain a copy of the License at
10*b1cdbd2cSJim Jagielski *
11*b1cdbd2cSJim Jagielski * http://www.apache.org/licenses/LICENSE-2.0
12*b1cdbd2cSJim Jagielski *
13*b1cdbd2cSJim Jagielski * Unless required by applicable law or agreed to in writing,
14*b1cdbd2cSJim Jagielski * software distributed under the License is distributed on an
15*b1cdbd2cSJim Jagielski * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*b1cdbd2cSJim Jagielski * KIND, either express or implied. See the License for the
17*b1cdbd2cSJim Jagielski * specific language governing permissions and limitations
18*b1cdbd2cSJim Jagielski * under the License.
19*b1cdbd2cSJim Jagielski *
20*b1cdbd2cSJim Jagielski *************************************************************/
21*b1cdbd2cSJim Jagielski
22*b1cdbd2cSJim Jagielski
23*b1cdbd2cSJim Jagielski
24*b1cdbd2cSJim Jagielski // MARKER(update_precomp.py): autogen include statement, do not remove
25*b1cdbd2cSJim Jagielski #include "precompiled_xmlsecurity.hxx"
26*b1cdbd2cSJim Jagielski
27*b1cdbd2cSJim Jagielski #include <stdio.h>
28*b1cdbd2cSJim Jagielski
29*b1cdbd2cSJim Jagielski #include <osl/mutex.hxx>
30*b1cdbd2cSJim Jagielski #include <osl/thread.h>
31*b1cdbd2cSJim Jagielski #include <cppuhelper/factory.hxx>
32*b1cdbd2cSJim Jagielski #include <com/sun/star/lang/XSingleServiceFactory.hpp>
33*b1cdbd2cSJim Jagielski
34*b1cdbd2cSJim Jagielski #include <decryptorimpl.hxx>
35*b1cdbd2cSJim Jagielski #include <encryptorimpl.hxx>
36*b1cdbd2cSJim Jagielski #include <signaturecreatorimpl.hxx>
37*b1cdbd2cSJim Jagielski #include <signatureverifierimpl.hxx>
38*b1cdbd2cSJim Jagielski #include <saxeventkeeperimpl.hxx>
39*b1cdbd2cSJim Jagielski #include <xmlencryptiontemplateimpl.hxx>
40*b1cdbd2cSJim Jagielski #include <xmlsignaturetemplateimpl.hxx>
41*b1cdbd2cSJim Jagielski
42*b1cdbd2cSJim Jagielski using namespace ::rtl;
43*b1cdbd2cSJim Jagielski using namespace ::cppu;
44*b1cdbd2cSJim Jagielski using namespace ::com::sun::star::uno;
45*b1cdbd2cSJim Jagielski using namespace ::com::sun::star::lang;
46*b1cdbd2cSJim Jagielski using namespace ::com::sun::star::registry;
47*b1cdbd2cSJim Jagielski
48*b1cdbd2cSJim Jagielski extern "C"
49*b1cdbd2cSJim Jagielski {
50*b1cdbd2cSJim Jagielski //==================================================================================================
component_getImplementationEnvironment(const sal_Char ** ppEnvTypeName,uno_Environment **)51*b1cdbd2cSJim Jagielski void SAL_CALL component_getImplementationEnvironment(
52*b1cdbd2cSJim Jagielski const sal_Char ** ppEnvTypeName, uno_Environment **)
53*b1cdbd2cSJim Jagielski {
54*b1cdbd2cSJim Jagielski *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
55*b1cdbd2cSJim Jagielski }
56*b1cdbd2cSJim Jagielski
57*b1cdbd2cSJim Jagielski //==================================================================================================
component_getFactory(const sal_Char * pImplName,void * pServiceManager,void *)58*b1cdbd2cSJim Jagielski void * SAL_CALL component_getFactory(
59*b1cdbd2cSJim Jagielski const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ )
60*b1cdbd2cSJim Jagielski {
61*b1cdbd2cSJim Jagielski void * pRet = 0;
62*b1cdbd2cSJim Jagielski
63*b1cdbd2cSJim Jagielski //Decryptor
64*b1cdbd2cSJim Jagielski OUString implName = OUString::createFromAscii( pImplName );
65*b1cdbd2cSJim Jagielski if ( pServiceManager && implName.equals(DecryptorImpl_getImplementationName()) )
66*b1cdbd2cSJim Jagielski {
67*b1cdbd2cSJim Jagielski Reference< XSingleServiceFactory > xFactory( createSingleFactory(
68*b1cdbd2cSJim Jagielski reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
69*b1cdbd2cSJim Jagielski OUString::createFromAscii( pImplName ),
70*b1cdbd2cSJim Jagielski DecryptorImpl_createInstance, DecryptorImpl_getSupportedServiceNames() ) );
71*b1cdbd2cSJim Jagielski
72*b1cdbd2cSJim Jagielski if (xFactory.is())
73*b1cdbd2cSJim Jagielski {
74*b1cdbd2cSJim Jagielski xFactory->acquire();
75*b1cdbd2cSJim Jagielski pRet = xFactory.get();
76*b1cdbd2cSJim Jagielski }
77*b1cdbd2cSJim Jagielski }
78*b1cdbd2cSJim Jagielski
79*b1cdbd2cSJim Jagielski //Encryptor
80*b1cdbd2cSJim Jagielski if ( pServiceManager && implName.equals(EncryptorImpl_getImplementationName()) )
81*b1cdbd2cSJim Jagielski {
82*b1cdbd2cSJim Jagielski Reference< XSingleServiceFactory > xFactory( createSingleFactory(
83*b1cdbd2cSJim Jagielski reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
84*b1cdbd2cSJim Jagielski OUString::createFromAscii( pImplName ),
85*b1cdbd2cSJim Jagielski EncryptorImpl_createInstance, EncryptorImpl_getSupportedServiceNames() ) );
86*b1cdbd2cSJim Jagielski
87*b1cdbd2cSJim Jagielski if (xFactory.is())
88*b1cdbd2cSJim Jagielski {
89*b1cdbd2cSJim Jagielski xFactory->acquire();
90*b1cdbd2cSJim Jagielski pRet = xFactory.get();
91*b1cdbd2cSJim Jagielski }
92*b1cdbd2cSJim Jagielski }
93*b1cdbd2cSJim Jagielski
94*b1cdbd2cSJim Jagielski //SignatureCreator
95*b1cdbd2cSJim Jagielski if ( pServiceManager && implName.equals(SignatureCreatorImpl_getImplementationName()) )
96*b1cdbd2cSJim Jagielski {
97*b1cdbd2cSJim Jagielski Reference< XSingleServiceFactory > xFactory( createSingleFactory(
98*b1cdbd2cSJim Jagielski reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
99*b1cdbd2cSJim Jagielski OUString::createFromAscii( pImplName ),
100*b1cdbd2cSJim Jagielski SignatureCreatorImpl_createInstance, SignatureCreatorImpl_getSupportedServiceNames() ) );
101*b1cdbd2cSJim Jagielski
102*b1cdbd2cSJim Jagielski if (xFactory.is())
103*b1cdbd2cSJim Jagielski {
104*b1cdbd2cSJim Jagielski xFactory->acquire();
105*b1cdbd2cSJim Jagielski pRet = xFactory.get();
106*b1cdbd2cSJim Jagielski }
107*b1cdbd2cSJim Jagielski }
108*b1cdbd2cSJim Jagielski
109*b1cdbd2cSJim Jagielski //SignatureVerifier
110*b1cdbd2cSJim Jagielski if ( pServiceManager && implName.equals(SignatureVerifierImpl_getImplementationName()) )
111*b1cdbd2cSJim Jagielski {
112*b1cdbd2cSJim Jagielski Reference< XSingleServiceFactory > xFactory( createSingleFactory(
113*b1cdbd2cSJim Jagielski reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
114*b1cdbd2cSJim Jagielski OUString::createFromAscii( pImplName ),
115*b1cdbd2cSJim Jagielski SignatureVerifierImpl_createInstance, SignatureVerifierImpl_getSupportedServiceNames() ) );
116*b1cdbd2cSJim Jagielski
117*b1cdbd2cSJim Jagielski if (xFactory.is())
118*b1cdbd2cSJim Jagielski {
119*b1cdbd2cSJim Jagielski xFactory->acquire();
120*b1cdbd2cSJim Jagielski pRet = xFactory.get();
121*b1cdbd2cSJim Jagielski }
122*b1cdbd2cSJim Jagielski }
123*b1cdbd2cSJim Jagielski
124*b1cdbd2cSJim Jagielski //SAXEventKeeper
125*b1cdbd2cSJim Jagielski if ( pServiceManager && implName.equals(SAXEventKeeperImpl_getImplementationName()) )
126*b1cdbd2cSJim Jagielski {
127*b1cdbd2cSJim Jagielski Reference< XSingleServiceFactory > xFactory( createSingleFactory(
128*b1cdbd2cSJim Jagielski reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
129*b1cdbd2cSJim Jagielski OUString::createFromAscii( pImplName ),
130*b1cdbd2cSJim Jagielski SAXEventKeeperImpl_createInstance, SAXEventKeeperImpl_getSupportedServiceNames() ) );
131*b1cdbd2cSJim Jagielski
132*b1cdbd2cSJim Jagielski if (xFactory.is())
133*b1cdbd2cSJim Jagielski {
134*b1cdbd2cSJim Jagielski xFactory->acquire();
135*b1cdbd2cSJim Jagielski pRet = xFactory.get();
136*b1cdbd2cSJim Jagielski }
137*b1cdbd2cSJim Jagielski }
138*b1cdbd2cSJim Jagielski
139*b1cdbd2cSJim Jagielski //XMLSignatureTemplate
140*b1cdbd2cSJim Jagielski if ( pServiceManager && implName.equals( XMLSignatureTemplateImpl::impl_getImplementationName()) )
141*b1cdbd2cSJim Jagielski {
142*b1cdbd2cSJim Jagielski Reference< XSingleServiceFactory > xFactory = XMLSignatureTemplateImpl::impl_createFactory(
143*b1cdbd2cSJim Jagielski reinterpret_cast< XMultiServiceFactory* >( pServiceManager ) ) ;
144*b1cdbd2cSJim Jagielski
145*b1cdbd2cSJim Jagielski if (xFactory.is())
146*b1cdbd2cSJim Jagielski {
147*b1cdbd2cSJim Jagielski xFactory->acquire();
148*b1cdbd2cSJim Jagielski pRet = xFactory.get();
149*b1cdbd2cSJim Jagielski }
150*b1cdbd2cSJim Jagielski }
151*b1cdbd2cSJim Jagielski
152*b1cdbd2cSJim Jagielski //XMLEncryptionTemplate
153*b1cdbd2cSJim Jagielski if ( pServiceManager && implName.equals( XMLEncryptionTemplateImpl::impl_getImplementationName()) )
154*b1cdbd2cSJim Jagielski {
155*b1cdbd2cSJim Jagielski Reference< XSingleServiceFactory > xFactory = XMLEncryptionTemplateImpl::impl_createFactory(
156*b1cdbd2cSJim Jagielski reinterpret_cast< XMultiServiceFactory* >( pServiceManager ) ) ;
157*b1cdbd2cSJim Jagielski
158*b1cdbd2cSJim Jagielski if (xFactory.is())
159*b1cdbd2cSJim Jagielski {
160*b1cdbd2cSJim Jagielski xFactory->acquire();
161*b1cdbd2cSJim Jagielski pRet = xFactory.get();
162*b1cdbd2cSJim Jagielski }
163*b1cdbd2cSJim Jagielski }
164*b1cdbd2cSJim Jagielski
165*b1cdbd2cSJim Jagielski return pRet;
166*b1cdbd2cSJim Jagielski }
167*b1cdbd2cSJim Jagielski }
168*b1cdbd2cSJim Jagielski
169*b1cdbd2cSJim Jagielski
170