1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 #include <cppuhelper/supportsservice.hxx>
11 #include <gpg/SEInitializer.hxx>
12 #include "SecurityEnvironment.hxx"
13 #include "XMLSecurityContext.hxx"
17 namespace com::sun::star::uno
19 class XComponentContext
;
23 using namespace css::lang
;
24 using namespace css::uno
;
25 using namespace css::xml::crypto
;
27 SEInitializerGpg::SEInitializerGpg()
29 // Also init GpgME while we're at it
30 GpgME::initializeLibrary();
33 SEInitializerGpg::~SEInitializerGpg() {}
36 Reference
<XXMLSecurityContext
> SAL_CALL
SEInitializerGpg::createSecurityContext(const OUString
&)
40 /* Build XML Security Context */
41 Reference
<XXMLSecurityContext
> xSecCtx(new XMLSecurityContextGpg());
43 Reference
<XSecurityEnvironment
> xSecEnv(new SecurityEnvironmentGpg());
44 sal_Int32 n
= xSecCtx
->addSecurityEnvironment(xSecEnv
);
45 //originally the SecurityEnvironment with the internal slot was set as default
46 xSecCtx
->setDefaultSecurityEnvironmentIndex(n
);
49 catch (const uno::Exception
&)
55 void SAL_CALL
SEInitializerGpg::freeSecurityContext(const uno::Reference
<XXMLSecurityContext
>&) {}
58 sal_Bool SAL_CALL
SEInitializerGpg::supportsService(const OUString
& rServiceName
)
60 return cppu::supportsService(this, rServiceName
);
63 uno::Sequence
<OUString
> SAL_CALL
SEInitializerGpg::getSupportedServiceNames()
65 return { u
"com.sun.star.xml.crypto.GPGSEInitializer"_ustr
};
68 OUString SAL_CALL
SEInitializerGpg::getImplementationName()
70 return u
"com.sun.star.xml.security.SEInitializer_Gpg"_ustr
;
73 extern "C" SAL_DLLPUBLIC_EXPORT
uno::XInterface
*
74 com_sun_star_xml_security_SEInitializer_Gpg_get_implementation(
75 uno::XComponentContext
* /*pCtx*/, uno::Sequence
<uno::Any
> const& /*rSeq*/)
77 return cppu::acquire(new SEInitializerGpg());
80 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */