From 1c58b047d117bb087abc571b74c06cdf7499b1a0 Mon Sep 17 00:00:00 2001 From: Katarina Behrens Date: Wed, 29 Nov 2017 23:07:47 +0100 Subject: Restore GPG SEInitializer service user config now needs it to collect user's private GPG keys Change-Id: Ia4ad4133b621160cf37281750cafa9f3c5c3c231 Reviewed-on: https://gerrit.libreoffice.org/45562 Tested-by: Jenkins Reviewed-by: Thorsten Behrens --- xmlsecurity/inc/gpg/SEInitializer.hxx | 22 ++++++++++++++++- xmlsecurity/source/gpg/SEInitializer.cxx | 39 +++++++++++++++++++++++++++++++ xmlsecurity/source/xmlsec/xsec_xmlsec.cxx | 7 +++++- xmlsecurity/util/xsec_xmlsec.component | 3 +++ 4 files changed, 69 insertions(+), 2 deletions(-) (limited to 'xmlsecurity') diff --git a/xmlsecurity/inc/gpg/SEInitializer.hxx b/xmlsecurity/inc/gpg/SEInitializer.hxx index db73d621f7be..3cc89da8d82d 100644 --- a/xmlsecurity/inc/gpg/SEInitializer.hxx +++ b/xmlsecurity/inc/gpg/SEInitializer.hxx @@ -13,14 +13,20 @@ #include #include #include +#include #include +#include #include #include #include #include -class XSECGPG_DLLPUBLIC SEInitializerGpg : public cppu::WeakImplHelper< css::xml::crypto::XSEInitializer > +class XSECGPG_DLLPUBLIC SEInitializerGpg : public cppu::WeakImplHelper +< + css::xml::crypto::XSEInitializer, + css::lang::XServiceInfo +> { public: SEInitializerGpg(); @@ -32,6 +38,20 @@ public: virtual void SAL_CALL freeSecurityContext( const css::uno::Reference< css::xml::crypto::XXMLSecurityContext >& securityContext ) override; + + static css::uno::Sequence< OUString > impl_getSupportedServiceNames(); + + static OUString impl_getImplementationName(); + + /* XServiceInfo */ + virtual OUString SAL_CALL getImplementationName( ) override; + + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; + + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override; + + static css::uno::Reference< css::uno::XInterface > SAL_CALL impl_createInstance( const css::uno::Reference< css::lang::XMultiServiceFactory >& aServiceManager ) ; + static css::uno::Reference< css::lang::XSingleServiceFactory > impl_createFactory( const css::uno::Reference< css::lang::XMultiServiceFactory >& aServiceManager ) ; }; #endif diff --git a/xmlsecurity/source/gpg/SEInitializer.cxx b/xmlsecurity/source/gpg/SEInitializer.cxx index 667e9ce355c7..93e2ab263d33 100644 --- a/xmlsecurity/source/gpg/SEInitializer.cxx +++ b/xmlsecurity/source/gpg/SEInitializer.cxx @@ -9,6 +9,8 @@ #include +#include +#include #include #include "SecurityEnvironment.hxx" #include "XMLSecurityContext.hxx" @@ -56,4 +58,41 @@ void SAL_CALL SEInitializerGpg::freeSecurityContext( const uno::Reference< XXMLS { } + + +uno::Reference< uno::XInterface > SAL_CALL SEInitializerGpg::impl_createInstance( const uno::Reference< lang::XMultiServiceFactory > & /*rxMSF*/) +{ + return static_cast(new SEInitializerGpg()); +} + +uno::Reference< XSingleServiceFactory > SEInitializerGpg::impl_createFactory( const Reference< XMultiServiceFactory >& aServiceManager ) { + return cppu::createSingleFactory( aServiceManager, impl_getImplementationName(), impl_createInstance, impl_getSupportedServiceNames() ) ; +} + +/* XServiceInfo */ +OUString SAL_CALL SEInitializerGpg::impl_getImplementationName() +{ + return OUString("com.sun.star.xml.security.SEInitializer_Gpg"); +} + +uno::Sequence< OUString > SAL_CALL SEInitializerGpg::impl_getSupportedServiceNames() +{ + return {"com.sun.star.xml.crypto.GPGSEInitializer"}; +} + +sal_Bool SAL_CALL SEInitializerGpg::supportsService( const OUString& rServiceName ) +{ + return cppu::supportsService(this, rServiceName); +} + +uno::Sequence< OUString > SAL_CALL SEInitializerGpg::getSupportedServiceNames() +{ + return impl_getSupportedServiceNames(); +} + +OUString SAL_CALL SEInitializerGpg::getImplementationName() +{ + return impl_getImplementationName(); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/xmlsecurity/source/xmlsec/xsec_xmlsec.cxx b/xmlsecurity/source/xmlsec/xsec_xmlsec.cxx index 265ab2f8f960..d65d92eb1374 100644 --- a/xmlsecurity/source/xmlsec/xsec_xmlsec.cxx +++ b/xmlsecurity/source/xmlsec/xsec_xmlsec.cxx @@ -29,7 +29,8 @@ #include #if GPGME_HAVE_GPGME -# include +#include +#include #endif using namespace ::cppu; @@ -50,6 +51,10 @@ SAL_DLLPUBLIC_EXPORT void* SAL_CALL xsec_xmlsec_component_getFactory( const sal_ { xFactory = XMLSignature_GpgImpl::impl_createFactory( static_cast< XMultiServiceFactory* >( pServiceManager ) ) ; } + else if( SEInitializerGpg::impl_getImplementationName().equalsAscii( pImplName ) ) + { + xFactory = SEInitializerGpg::impl_createFactory( static_cast< XMultiServiceFactory* >( pServiceManager ) ) ; + } else #endif if( XMLElementWrapper_XmlSecImpl_getImplementationName().equalsAscii( pImplName ) ) diff --git a/xmlsecurity/util/xsec_xmlsec.component b/xmlsecurity/util/xsec_xmlsec.component index ff0e09b82f92..d47ceef0b8d5 100644 --- a/xmlsecurity/util/xsec_xmlsec.component +++ b/xmlsecurity/util/xsec_xmlsec.component @@ -26,6 +26,9 @@ + + + -- cgit