Kaydet (Commit) c7fa2da1 authored tarafından Katarina Behrens's avatar Katarina Behrens Kaydeden (comit) Thorsten Behrens

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/45562Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarThorsten Behrens <Thorsten.Behrens@CIB.de>
(cherry picked from commit 1c58b047)
üst bfe2fb8c
......@@ -18,6 +18,13 @@
*/
#include <comphelper/string.hxx>
#include <config_gpgme.h>
#if GPGME_HAVE_GPGME
#include <com/sun/star/xml/crypto/GPGSEInitializer.hpp>
#include <com/sun/star/xml/crypto/XXMLSecurityContext.hpp>
#endif
#include <i18nlangtag/mslangid.hxx>
#include <vcl/svapp.hxx>
#include <vcl/msgbox.hxx>
......@@ -32,6 +39,8 @@
#include <svx/dlgutil.hxx>
#include <svx/svxids.hrc>
using namespace css;
namespace
{
......@@ -205,6 +214,19 @@ SvxGeneralTabPage::SvxGeneralTabPage(vcl::Window* pParent, const SfxItemSet& rCo
InitControls();
SetExchangeSupport(); // this page needs ExchangeSupport
SetLinks();
#if GPGME_HAVE_GPGME
// unused yet, I just wanted to see if this delivers the desired results
uno::Reference< xml::crypto::XSEInitializer > xSEInitializer;
try
{
xSEInitializer = xml::crypto::GPGSEInitializer::create( comphelper::getProcessComponentContext() );
uno::Reference<xml::crypto::XXMLSecurityContext> xSC = xSEInitializer->createSecurityContext( OUString() );
// completely bogus, this is just to appease loplugins
xSEInitializer->freeSecurityContext( xSC );
}
catch ( uno::Exception const & )
{}
#endif
}
SvxGeneralTabPage::~SvxGeneralTabPage()
......
......@@ -461,6 +461,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,com/sun/star/xml/crypto,\
NSSInitializer \
SecurityEnvironment \
SEInitializer \
GPGSEInitializer \
XMLSecurityContext \
))
$(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,com/sun/star/xml/dom,\
......
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef __com_sun_star_xml_crypto_GPGSEInitializer_idl_
#define __com_sun_star_xml_crypto_GPGSEInitializer_idl_
#include <com/sun/star/xml/crypto/XSEInitializer.idl>
module com { module sun { module star { module xml { module crypto {
/**
* Service of GPGSEInitializer
*/
service GPGSEInitializer : XSEInitializer;
} ; } ; } ; } ; } ;
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -13,14 +13,20 @@
#include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/uno/Reference.hxx>
#include <com/sun/star/uno/Sequence.hxx>
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/xml/crypto/XXMLSecurityContext.hpp>
#include <com/sun/star/xml/crypto/XSEInitializer.hpp>
#include <xsecgpgdllapi.h>
#include <cppuhelper/implbase.hxx>
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
......
......@@ -9,6 +9,8 @@
#include <config_gpgme.h>
#include <comphelper/processfactory.hxx>
#include <cppuhelper/supportsservice.hxx>
#include <gpg/SEInitializer.hxx>
#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<cppu::OWeakObject*>(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: */
......@@ -29,7 +29,8 @@
#include <config_gpgme.h>
#if GPGME_HAVE_GPGME
# include <gpg/xmlsignature_gpgimpl.hxx>
#include <gpg/xmlsignature_gpgimpl.hxx>
#include <gpg/SEInitializer.hxx>
#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 ) )
......
......@@ -26,6 +26,9 @@
<service name="com.sun.star.xml.crypto.NSSInitializer"/>
<service name="com.sun.star.xml.crypto.SEInitializer"/>
</implementation>
<implementation name="com.sun.star.xml.security.SEInitializer_Gpg">
<service name="com.sun.star.xml.crypto.GPGSEInitializer"/>
</implementation>
<implementation name="com.sun.star.xml.security.bridge.xmlsec.SecurityEnvironment_NssImpl">
<service name="com.sun.star.xml.crypto.SecurityEnvironment"/>
</implementation>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment