summaryrefslogtreecommitdiff
path: root/xmlsecurity
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2018-02-21 22:15:05 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2018-02-23 09:05:59 +0100
commita2e53070ca807e1974c462d9ae8f7098990c9356 (patch)
tree5c63778a5b473a9525476ec1defefea112f50595 /xmlsecurity
parentb9e591e7ab7eaa3ea7539ea3f778bda89177219c (diff)
xmlsecurity mscrypt: create XMLSignature instances with a constructor
Change-Id: Ie30885226d1ede4293adc888e587d6111343f5af Reviewed-on: https://gerrit.libreoffice.org/50144 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'xmlsecurity')
-rw-r--r--xmlsecurity/source/xmlsec/mscrypt/xmlsignature_mscryptimpl.cxx58
-rw-r--r--xmlsecurity/source/xmlsec/mscrypt/xmlsignature_mscryptimpl.hxx83
-rw-r--r--xmlsecurity/source/xmlsec/mscrypt/xsec_mscrypt.cxx5
-rw-r--r--xmlsecurity/util/xsec_xmlsec.windows.component3
4 files changed, 41 insertions, 108 deletions
diff --git a/xmlsecurity/source/xmlsec/mscrypt/xmlsignature_mscryptimpl.cxx b/xmlsecurity/source/xmlsec/mscrypt/xmlsignature_mscryptimpl.cxx
index 3213f9e9e2e6..f7ade4e54161 100644
--- a/xmlsecurity/source/xmlsec/mscrypt/xmlsignature_mscryptimpl.cxx
+++ b/xmlsecurity/source/xmlsec/mscrypt/xmlsignature_mscryptimpl.cxx
@@ -21,8 +21,8 @@
#include <rtl/uuid.h>
#include <com/sun/star/xml/crypto/SecurityOperationStatus.hpp>
+#include <com/sun/star/xml/crypto/XXMLSignature.hpp>
-#include "xmlsignature_mscryptimpl.hxx"
#include "securityenvironment_mscryptimpl.hxx"
#include <xmlsec/xmldocumentwrapper_xmlsecimpl.hxx>
@@ -32,6 +32,7 @@
#include <xmlsec-wrapper.h>
+using namespace ::com::sun::star;
using namespace ::com::sun::star::uno ;
using namespace ::com::sun::star::lang ;
using ::com::sun::star::lang::XMultiServiceFactory ;
@@ -45,7 +46,36 @@ using ::com::sun::star::xml::crypto::XXMLSignatureTemplate ;
using ::com::sun::star::xml::crypto::XXMLSecurityContext ;
using ::com::sun::star::xml::crypto::XUriBinding ;
-XMLSignature_MSCryptImpl::XMLSignature_MSCryptImpl( const Reference< XMultiServiceFactory >& aFactory ) : m_xServiceManager( aFactory ) {
+class XMLSignature_MSCryptImpl : public ::cppu::WeakImplHelper<
+ css::xml::crypto::XXMLSignature ,
+ css::lang::XServiceInfo >
+{
+ public:
+ explicit XMLSignature_MSCryptImpl();
+ virtual ~XMLSignature_MSCryptImpl() override;
+
+ //Methods from XXMLSignature
+ virtual css::uno::Reference< css::xml::crypto::XXMLSignatureTemplate > SAL_CALL generate(
+ const css::uno::Reference< css::xml::crypto::XXMLSignatureTemplate >& aTemplate ,
+ const css::uno::Reference< css::xml::crypto::XSecurityEnvironment >& aEnvironment
+ ) override;
+
+ virtual css::uno::Reference< css::xml::crypto::XXMLSignatureTemplate > SAL_CALL validate(
+ const css::uno::Reference< css::xml::crypto::XXMLSignatureTemplate >& aTemplate ,
+ const css::uno::Reference< css::xml::crypto::XXMLSecurityContext >& aContext
+ ) override;
+
+ //Methods from 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;
+} ;
+
+XMLSignature_MSCryptImpl::XMLSignature_MSCryptImpl() {
}
XMLSignature_MSCryptImpl::~XMLSignature_MSCryptImpl() {
@@ -251,7 +281,7 @@ SAL_CALL XMLSignature_MSCryptImpl::validate(
/* XServiceInfo */
OUString SAL_CALL XMLSignature_MSCryptImpl::getImplementationName() {
- return impl_getImplementationName() ;
+ return OUString("com.sun.star.xml.crypto.XMLSignature");
}
/* XServiceInfo */
@@ -267,27 +297,15 @@ sal_Bool SAL_CALL XMLSignature_MSCryptImpl::supportsService( const OUString& ser
/* XServiceInfo */
Sequence< OUString > SAL_CALL XMLSignature_MSCryptImpl::getSupportedServiceNames() {
- return impl_getSupportedServiceNames() ;
-}
-
-//Helper for XServiceInfo
-Sequence< OUString > XMLSignature_MSCryptImpl::impl_getSupportedServiceNames() {
- ::osl::Guard< ::osl::Mutex > aGuard( ::osl::Mutex::getGlobalMutex() ) ;
Sequence<OUString> seqServiceNames { "com.sun.star.xml.crypto.XMLSignature" };
return seqServiceNames ;
}
-OUString XMLSignature_MSCryptImpl::impl_getImplementationName() {
- return OUString("com.sun.star.xml.security.bridge.xmlsec.XMLSignature_MSCryptImpl") ;
-}
-
-//Helper for registry
-Reference< XInterface > SAL_CALL XMLSignature_MSCryptImpl::impl_createInstance( const Reference< XMultiServiceFactory >& aServiceManager ) {
- return Reference< XInterface >( *new XMLSignature_MSCryptImpl( aServiceManager ) ) ;
-}
-
-Reference< XSingleServiceFactory > XMLSignature_MSCryptImpl::impl_createFactory( const Reference< XMultiServiceFactory >& aServiceManager ) {
- return ::cppu::createSingleFactory( aServiceManager , impl_getImplementationName() , impl_createInstance , impl_getSupportedServiceNames() ) ;
+extern "C" SAL_DLLPUBLIC_EXPORT uno::XInterface*
+com_sun_star_xml_crypto_XMLSignature_get_implementation(uno::XComponentContext* /*pCtx*/,
+ uno::Sequence<uno::Any> const& /*rSeq*/)
+{
+ return cppu::acquire(new XMLSignature_MSCryptImpl);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmlsecurity/source/xmlsec/mscrypt/xmlsignature_mscryptimpl.hxx b/xmlsecurity/source/xmlsec/mscrypt/xmlsignature_mscryptimpl.hxx
deleted file mode 100644
index a5cb5c6398a7..000000000000
--- a/xmlsecurity/source/xmlsec/mscrypt/xmlsignature_mscryptimpl.hxx
+++ /dev/null
@@ -1,83 +0,0 @@
-/* -*- 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 INCLUDED_XMLSECURITY_SOURCE_XMLSEC_MSCRYPT_XMLSIGNATURE_MSCRYPTIMPL_HXX
-#define INCLUDED_XMLSECURITY_SOURCE_XMLSEC_MSCRYPT_XMLSIGNATURE_MSCRYPTIMPL_HXX
-
-#include <sal/config.h>
-#include <rtl/ustring.hxx>
-#include <cppuhelper/factory.hxx>
-#include <cppuhelper/implbase.hxx>
-#include <com/sun/star/uno/Exception.hpp>
-
-#include <com/sun/star/uno/Reference.hxx>
-#include <com/sun/star/lang/XSingleServiceFactory.hpp>
-
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/xml/crypto/XXMLSignature.hpp>
-#include <com/sun/star/xml/crypto/XXMLSignatureTemplate.hpp>
-#include <com/sun/star/xml/crypto/XXMLSecurityContext.hpp>
-
-class XMLSignature_MSCryptImpl : public ::cppu::WeakImplHelper<
- css::xml::crypto::XXMLSignature ,
- css::lang::XServiceInfo >
-{
- private:
- css::uno::Reference< css::lang::XMultiServiceFactory > m_xServiceManager ;
-
- public:
- explicit XMLSignature_MSCryptImpl(const css::uno::Reference<css::lang::XMultiServiceFactory >& rFactory);
- virtual ~XMLSignature_MSCryptImpl() override;
-
- //Methods from XXMLSignature
- virtual css::uno::Reference< css::xml::crypto::XXMLSignatureTemplate > SAL_CALL generate(
- const css::uno::Reference< css::xml::crypto::XXMLSignatureTemplate >& aTemplate ,
- const css::uno::Reference< css::xml::crypto::XSecurityEnvironment >& aEnvironment
- ) override;
-
- virtual css::uno::Reference< css::xml::crypto::XXMLSignatureTemplate > SAL_CALL validate(
- const css::uno::Reference< css::xml::crypto::XXMLSignatureTemplate >& aTemplate ,
- const css::uno::Reference< css::xml::crypto::XXMLSecurityContext >& aContext
- ) override;
-
- //Methods from 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;
-
- //Helper for XServiceInfo
- static css::uno::Sequence< OUString > impl_getSupportedServiceNames() ;
-
- /// @throws css::uno::RuntimeException
- static OUString impl_getImplementationName() ;
-
- //Helper for registry
- /// @throws css::uno::RuntimeException
- 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 // INCLUDED_XMLSECURITY_SOURCE_XMLSEC_MSCRYPT_XMLSIGNATURE_MSCRYPTIMPL_HXX
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmlsecurity/source/xmlsec/mscrypt/xsec_mscrypt.cxx b/xmlsecurity/source/xmlsec/mscrypt/xsec_mscrypt.cxx
index e55569c7ef4f..0661ed8594d7 100644
--- a/xmlsecurity/source/xmlsec/mscrypt/xsec_mscrypt.cxx
+++ b/xmlsecurity/source/xmlsec/mscrypt/xsec_mscrypt.cxx
@@ -25,7 +25,6 @@
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
#include "seinitializer_mscryptimpl.hxx"
-#include "xmlsignature_mscryptimpl.hxx"
#include "xmlsecuritycontext_mscryptimpl.hxx"
#include "securityenvironment_mscryptimpl.hxx"
@@ -43,9 +42,7 @@ void* mscrypt_component_getFactory( const sal_Char* pImplName , void* pServiceMa
Reference< XSingleServiceFactory > xFactory ;
if( pImplName != nullptr && pServiceManager != nullptr ) {
- if( XMLSignature_MSCryptImpl::impl_getImplementationName().equalsAscii( pImplName ) ) {
- xFactory = XMLSignature_MSCryptImpl::impl_createFactory( static_cast< XMultiServiceFactory* >( pServiceManager ) ) ;
- } else if( XMLSecurityContext_MSCryptImpl::impl_getImplementationName().equalsAscii( pImplName ) ) {
+ if( XMLSecurityContext_MSCryptImpl::impl_getImplementationName().equalsAscii( pImplName ) ) {
xFactory = XMLSecurityContext_MSCryptImpl::impl_createFactory( static_cast< XMultiServiceFactory* >( pServiceManager ) ) ;
} else if( SecurityEnvironment_MSCryptImpl::impl_getImplementationName().equalsAscii( pImplName ) ) {
xFactory = SecurityEnvironment_MSCryptImpl::impl_createFactory( static_cast< XMultiServiceFactory* >( pServiceManager ) ) ;
diff --git a/xmlsecurity/util/xsec_xmlsec.windows.component b/xmlsecurity/util/xsec_xmlsec.windows.component
index fc7df19b1b9e..7b6840c53521 100644
--- a/xmlsecurity/util/xsec_xmlsec.windows.component
+++ b/xmlsecurity/util/xsec_xmlsec.windows.component
@@ -37,7 +37,8 @@
<implementation name="com.sun.star.xml.security.bridge.xmlsec.XMLSecurityContext_MSCryptImpl">
<service name="com.sun.star.xml.crypto.XMLSecurityContext"/>
</implementation>
- <implementation name="com.sun.star.xml.security.bridge.xmlsec.XMLSignature_MSCryptImpl">
+ <implementation name="com.sun.star.xml.crypto.XMLSignature"
+ constructor="com_sun_star_xml_crypto_XMLSignature_get_implementation">
<service name="com.sun.star.xml.crypto.XMLSignature"/>
</implementation>
</component>