summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2012-10-31 14:58:31 +0200
committerStephan Bergmann <sbergman@redhat.com>2012-11-05 16:43:14 +0100
commit1dedb15b17a8e8bf04f248809ef48db663034254 (patch)
treee8fc086787fb7506046b8a7756a24b76e2f4bde3
parent4c49af256a456af48f0b29262c0b23aa1f6a9cd5 (diff)
fdo#46808, Adapt xml::crypto::SEInitializer UNO service to new style
Also create an NSSInitializer service IDL and split it's interfaces out from SEInitializer. It looks like this was the intention all along, but someone took a shortcut. Change-Id: I53ac1cb5d38b78b6718fe22c9666eae1f194a3b7
-rw-r--r--offapi/UnoApi_offapi.mk5
-rw-r--r--offapi/com/sun/star/xml/crypto/NSSInitializer.idl37
-rw-r--r--offapi/com/sun/star/xml/crypto/SEInitializer.idl12
-rw-r--r--offapi/com/sun/star/xml/crypto/XNSSInitializer.idl41
-rw-r--r--package/inc/ZipFile.hxx16
-rw-r--r--package/inc/ZipOutputStream.hxx4
-rw-r--r--package/inc/zipfileaccess.hxx6
-rw-r--r--package/source/zipapi/XUnbufferedStream.cxx8
-rw-r--r--package/source/zipapi/XUnbufferedStream.hxx4
-rw-r--r--package/source/zipapi/ZipFile.cxx49
-rw-r--r--package/source/zipapi/ZipOutputStream.cxx8
-rw-r--r--package/source/zippackage/ZipPackage.cxx6
-rw-r--r--package/source/zippackage/ZipPackageStream.cxx2
-rw-r--r--package/source/zippackage/zipfileaccess.cxx14
-rw-r--r--ucb/source/ucp/webdav-neon/NeonSession.cxx9
-rw-r--r--xmlsecurity/inc/xmlsecurity/xmlsignaturehelper.hxx1
-rw-r--r--xmlsecurity/qa/certext/SanCertExt.cxx6
-rw-r--r--xmlsecurity/source/helper/xmlsignaturehelper.cxx14
-rw-r--r--xmlsecurity/source/xmlsec/nss/nssinitializer.cxx33
-rw-r--r--xmlsecurity/source/xmlsec/nss/nssinitializer.hxx16
-rw-r--r--xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx50
-rw-r--r--xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.hxx4
22 files changed, 198 insertions, 147 deletions
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index 7e1bc58fcea4..f5f641a83c43 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -319,6 +319,10 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/util,\
UriAbbreviation \
URLTransformer \
))
+$(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/xml/crypto,\
+ NSSInitializer \
+ SEInitializer \
+))
$(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/xml/dom,\
DocumentBuilder \
SAXDocumentBuilder \
@@ -4157,6 +4161,7 @@ $(eval $(call gb_UnoApi_add_idlfiles,offapi,offapi/com/sun/star/xml/crypto,\
XDigestContextSupplier \
XMLEncryptionException \
XMLSignatureException \
+ XNSSInitializer \
XSEInitializer \
XSecurityEnvironment \
XUriBinding \
diff --git a/offapi/com/sun/star/xml/crypto/NSSInitializer.idl b/offapi/com/sun/star/xml/crypto/NSSInitializer.idl
new file mode 100644
index 000000000000..cfffec4dcbc0
--- /dev/null
+++ b/offapi/com/sun/star/xml/crypto/NSSInitializer.idl
@@ -0,0 +1,37 @@
+/* -*- 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_NSSInitializer_idl_
+#define __com_sun_star_xml_crypto_NSSInitializer_idl_
+
+#include <com/sun/star/xml/crypto/XNSSInitializer.idl>
+
+module com { module sun { module star { module xml { module crypto {
+
+/**
+ @since LibreOffice 3.7
+ */
+service NSSInitializer : XNSSInitializer;
+
+} ; } ; } ; } ; } ;
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/offapi/com/sun/star/xml/crypto/SEInitializer.idl b/offapi/com/sun/star/xml/crypto/SEInitializer.idl
index 40655ee3bd55..cd4c5cd264db 100644
--- a/offapi/com/sun/star/xml/crypto/SEInitializer.idl
+++ b/offapi/com/sun/star/xml/crypto/SEInitializer.idl
@@ -17,23 +17,17 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
-#ifndef __com_sun_star_xml_crypto_seinitializer_idl_
-#define __com_sun_star_xml_crypto_seinitializer_idl_
+#ifndef __com_sun_star_xml_crypto_SEInitializer_idl_
+#define __com_sun_star_xml_crypto_SEInitializer_idl_
#include <com/sun/star/xml/crypto/XSEInitializer.idl>
-#include <com/sun/star/xml/crypto/XCipherContextSupplier.idl>
-#include <com/sun/star/xml/crypto/XDigestContextSupplier.idl>
module com { module sun { module star { module xml { module crypto {
/**
* Service of SEInitializer
*/
-service SEInitializer {
- interface ::com::sun::star::xml::crypto::XSEInitializer;
- interface ::com::sun::star::xml::crypto::XDigestContextSupplier;
- interface ::com::sun::star::xml::crypto::XCipherContextSupplier;
-};
+service SEInitializer : XSEInitializer;
} ; } ; } ; } ; } ;
diff --git a/offapi/com/sun/star/xml/crypto/XNSSInitializer.idl b/offapi/com/sun/star/xml/crypto/XNSSInitializer.idl
new file mode 100644
index 000000000000..f5368fe74a21
--- /dev/null
+++ b/offapi/com/sun/star/xml/crypto/XNSSInitializer.idl
@@ -0,0 +1,41 @@
+/* -*- 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_XNSSInitializer_idl_
+#define __com_sun_star_xml_crypto_XNSSInitializer_idl_
+
+#include <com/sun/star/xml/crypto/XCipherContextSupplier.idl>
+#include <com/sun/star/xml/crypto/XDigestContextSupplier.idl>
+
+module com { module sun { module star { module xml { module crypto {
+
+/**
+ @since LibreOffice 3.7
+ */
+interface XNSSInitializer {
+ interface ::com::sun::star::xml::crypto::XDigestContextSupplier;
+ interface ::com::sun::star::xml::crypto::XCipherContextSupplier;
+};
+
+} ; } ; } ; } ; } ;
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/package/inc/ZipFile.hxx b/package/inc/ZipFile.hxx
index e438156cee0c..59a0027ff028 100644
--- a/package/inc/ZipFile.hxx
+++ b/package/inc/ZipFile.hxx
@@ -34,7 +34,7 @@
#include <mutexholder.hxx>
namespace com { namespace sun { namespace star {
- namespace lang { class XMultiServiceFactory; }
+ namespace uno { class XComponentContext; }
namespace ucb { class XProgressHandler; }
} } }
namespace rtl
@@ -63,7 +63,7 @@ protected:
ZipUtils::Inflater aInflater;
com::sun::star::uno::Reference < com::sun::star::io::XInputStream > xStream;
com::sun::star::uno::Reference < com::sun::star::io::XSeekable > xSeek;
- const ::com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory > m_xFactory;
+ const ::com::sun::star::uno::Reference < com::sun::star::uno::XComponentContext > m_xContext;
::com::sun::star::uno::Reference < ::com::sun::star::ucb::XProgressHandler > xProgressHandler;
sal_Bool bRecoveryMode;
@@ -100,13 +100,13 @@ protected:
public:
ZipFile( com::sun::star::uno::Reference < com::sun::star::io::XInputStream > &xInput,
- const com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory > &xNewFactory,
+ const com::sun::star::uno::Reference < com::sun::star::uno::XComponentContext > &rxContext,
sal_Bool bInitialise
)
throw(::com::sun::star::io::IOException, com::sun::star::packages::zip::ZipException, com::sun::star::uno::RuntimeException);
ZipFile( com::sun::star::uno::Reference < com::sun::star::io::XInputStream > &xInput,
- const com::sun::star::uno::Reference < com::sun::star::lang::XMultiServiceFactory > &xNewFactory,
+ const com::sun::star::uno::Reference < com::sun::star::uno::XComponentContext > &rxContext,
sal_Bool bInitialise,
sal_Bool bForceRecover,
::com::sun::star::uno::Reference < ::com::sun::star::ucb::XProgressHandler > xProgress
@@ -127,11 +127,11 @@ public:
static ::com::sun::star::uno::Reference< ::com::sun::star::xml::crypto::XDigestContext > StaticGetDigestContextForChecksum(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xArgFactory,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xArgContext,
const ::rtl::Reference< EncryptionData >& xEncryptionData );
static ::com::sun::star::uno::Reference< ::com::sun::star::xml::crypto::XCipherContext > StaticGetCipher(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xArgFactory,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xArgContext,
const ::rtl::Reference< EncryptionData >& xEncryptionData,
bool bEncrypt );
@@ -150,7 +150,7 @@ public:
const ::com::sun::star::uno::Reference < com::sun::star::io::XInputStream >& rStream );
static ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > StaticGetDataFromRawStream(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xStream,
const ::rtl::Reference < EncryptionData > &rData )
throw ( ::com::sun::star::packages::WrongPasswordException,
@@ -158,7 +158,7 @@ public:
::com::sun::star::uno::RuntimeException );
static sal_Bool StaticHasValidPassword (
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
const ::com::sun::star::uno::Sequence< sal_Int8 > &aReadBuffer,
const ::rtl::Reference < EncryptionData > &rData );
diff --git a/package/inc/ZipOutputStream.hxx b/package/inc/ZipOutputStream.hxx
index 10c26d9b5c46..0f1970725632 100644
--- a/package/inc/ZipOutputStream.hxx
+++ b/package/inc/ZipOutputStream.hxx
@@ -41,7 +41,7 @@ namespace rtl
class ZipOutputStream
{
protected:
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext> m_xContext;
::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > xStream;
::std::vector < ZipEntry * > aZipList;
@@ -63,7 +63,7 @@ protected:
public:
ZipOutputStream(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
const ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > &xOStream );
~ZipOutputStream();
diff --git a/package/inc/zipfileaccess.hxx b/package/inc/zipfileaccess.hxx
index 54299724e6a3..0d87fe6a6de0 100644
--- a/package/inc/zipfileaccess.hxx
+++ b/package/inc/zipfileaccess.hxx
@@ -44,7 +44,7 @@ class OZipFileAccess : public ::cppu::WeakImplHelper5<
{
SotMutexHolderRef m_aMutexHolder;
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > m_xContentStream;
ZipFile* m_pZipFile;
@@ -54,7 +54,7 @@ class OZipFileAccess : public ::cppu::WeakImplHelper5<
sal_Bool m_bDisposed;
public:
- OZipFileAccess( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory );
+ OZipFileAccess( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext );
virtual ~OZipFileAccess();
@@ -69,7 +69,7 @@ public:
static ::rtl::OUString SAL_CALL impl_staticGetImplementationName();
static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL impl_staticCreateSelfInstance(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager );
+ const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxMSF );
// XInitialization
diff --git a/package/source/zipapi/XUnbufferedStream.cxx b/package/source/zipapi/XUnbufferedStream.cxx
index 559e72feabdd..37599c3678f1 100644
--- a/package/source/zipapi/XUnbufferedStream.cxx
+++ b/package/source/zipapi/XUnbufferedStream.cxx
@@ -41,7 +41,7 @@ using com::sun::star::packages::zip::ZipIOException;
using ::rtl::OUString;
XUnbufferedStream::XUnbufferedStream(
- const uno::Reference< lang::XMultiServiceFactory >& xFactory,
+ const uno::Reference< uno::XComponentContext >& xContext,
SotMutexHolderRef aMutexHolder,
ZipEntry & rEntry,
Reference < XInputStream > xNewZipStream,
@@ -87,7 +87,7 @@ XUnbufferedStream::XUnbufferedStream(
if ( bMustDecrypt )
{
- m_xCipherContext = ZipFile::StaticGetCipher( xFactory, rData, false );
+ m_xCipherContext = ZipFile::StaticGetCipher( xContext, rData, false );
mnBlockSize = ( rData->m_nEncAlg == xml::crypto::CipherID::AES_CBC_W3C_PADDING ? 16 : 1 );
}
@@ -111,7 +111,7 @@ XUnbufferedStream::XUnbufferedStream(
// allows to read package raw stream
XUnbufferedStream::XUnbufferedStream(
- const uno::Reference< lang::XMultiServiceFactory >& /*xFactory*/,
+ const uno::Reference< uno::XComponentContext >& /*xContext*/,
const Reference < XInputStream >& xRawStream,
const ::rtl::Reference< EncryptionData >& rData )
: maMutexHolder( new SotMutexHolder )
@@ -148,7 +148,7 @@ XUnbufferedStream::XUnbufferedStream(
mnZipEnd = mnZipCurrent + mnZipSize;
// the raw data will not be decrypted, no need for the cipher
- // m_xCipherContext = ZipFile::StaticGetCipher( xFactory, rData, false );
+ // m_xCipherContext = ZipFile::StaticGetCipher( xContext, rData, false );
}
XUnbufferedStream::~XUnbufferedStream()
diff --git a/package/source/zipapi/XUnbufferedStream.hxx b/package/source/zipapi/XUnbufferedStream.hxx
index 3f68b326d55e..4bfa35c49a05 100644
--- a/package/source/zipapi/XUnbufferedStream.hxx
+++ b/package/source/zipapi/XUnbufferedStream.hxx
@@ -61,7 +61,7 @@ protected:
public:
XUnbufferedStream(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext,
SotMutexHolderRef aMutexHolder,
ZipEntry & rEntry,
com::sun::star::uno::Reference < com::sun::star::io::XInputStream > xNewZipStream,
@@ -73,7 +73,7 @@ public:
// allows to read package raw stream
XUnbufferedStream(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext,
const com::sun::star::uno::Reference < com::sun::star::io::XInputStream >& xRawStream,
const ::rtl::Reference< EncryptionData >& rData );
diff --git a/package/source/zipapi/ZipFile.cxx b/package/source/zipapi/ZipFile.cxx
index 83984d68a170..0da4c337ef60 100644
--- a/package/source/zipapi/ZipFile.cxx
+++ b/package/source/zipapi/ZipFile.cxx
@@ -27,6 +27,7 @@
#include <com/sun/star/xml/crypto/XDigestContextSupplier.hpp>
#include <com/sun/star/xml/crypto/CipherID.hpp>
#include <com/sun/star/xml/crypto/DigestID.hpp>
+#include <com/sun/star/xml/crypto/NSSInitializer.hpp>
#include <comphelper/storagehelper.hxx>
#include <comphelper/processfactory.hxx>
@@ -62,13 +63,13 @@ using ZipUtils::Inflater;
/** This class is used to read entries from a zip file
*/
-ZipFile::ZipFile( uno::Reference < XInputStream > &xInput, const uno::Reference < XMultiServiceFactory > &xNewFactory, sal_Bool bInitialise )
+ZipFile::ZipFile( uno::Reference < XInputStream > &xInput, const uno::Reference < XComponentContext > & rxContext, sal_Bool bInitialise )
throw(IOException, ZipException, RuntimeException)
: aGrabber(xInput)
, aInflater (sal_True)
, xStream(xInput)
, xSeek(xInput, UNO_QUERY)
-, m_xFactory ( xNewFactory )
+, m_xContext ( rxContext )
, bRecoveryMode( sal_False )
{
if (bInitialise)
@@ -83,13 +84,13 @@ ZipFile::ZipFile( uno::Reference < XInputStream > &xInput, const uno::Reference
-ZipFile::ZipFile( uno::Reference < XInputStream > &xInput, const uno::Reference < XMultiServiceFactory > &xNewFactory, sal_Bool bInitialise, sal_Bool bForceRecovery, uno::Reference < XProgressHandler > xProgress )
+ZipFile::ZipFile( uno::Reference < XInputStream > &xInput, const uno::Reference < XComponentContext > & rxContext, sal_Bool bInitialise, sal_Bool bForceRecovery, uno::Reference < XProgressHandler > xProgress )
throw(IOException, ZipException, RuntimeException)
: aGrabber(xInput)
, aInflater (sal_True)
, xStream(xInput)
, xSeek(xInput, UNO_QUERY)
-, m_xFactory ( xNewFactory )
+, m_xContext ( rxContext )
, xProgressHandler( xProgress )
, bRecoveryMode( bForceRecovery )
{
@@ -121,18 +122,16 @@ void ZipFile::setInputStream ( uno::Reference < XInputStream > xNewStream )
aGrabber.setInputStream ( xStream );
}
-uno::Reference< xml::crypto::XDigestContext > ZipFile::StaticGetDigestContextForChecksum( const uno::Reference< lang::XMultiServiceFactory >& xArgFactory, const ::rtl::Reference< EncryptionData >& xEncryptionData )
+uno::Reference< xml::crypto::XDigestContext > ZipFile::StaticGetDigestContextForChecksum( const uno::Reference< uno::XComponentContext >& xArgContext, const ::rtl::Reference< EncryptionData >& xEncryptionData )
{
uno::Reference< xml::crypto::XDigestContext > xDigestContext;
if ( xEncryptionData->m_nCheckAlg == xml::crypto::DigestID::SHA256_1K )
{
- uno::Reference< lang::XMultiServiceFactory > xFactory = xArgFactory;
- if ( !xFactory.is() )
- xFactory.set( comphelper::getProcessServiceFactory(), uno::UNO_SET_THROW );
+ uno::Reference< uno::XComponentContext > xContext = xArgContext;
+ if ( !xContext.is() )
+ xContext = comphelper::getProcessComponentContext();
- uno::Reference< xml::crypto::XDigestContextSupplier > xDigestContextSupplier(
- xFactory->createInstance("com.sun.star.xml.crypto.NSSInitializer"),
- uno::UNO_QUERY_THROW );
+ uno::Reference< xml::crypto::XNSSInitializer > xDigestContextSupplier = xml::crypto::NSSInitializer::create( xContext );
xDigestContext.set( xDigestContextSupplier->getDigestContext( xEncryptionData->m_nCheckAlg, uno::Sequence< beans::NamedValue >() ), uno::UNO_SET_THROW );
}
@@ -142,7 +141,7 @@ uno::Reference< xml::crypto::XDigestContext > ZipFile::StaticGetDigestContextFor
return xDigestContext;
}
-uno::Reference< xml::crypto::XCipherContext > ZipFile::StaticGetCipher( const uno::Reference< lang::XMultiServiceFactory >& xArgFactory, const ::rtl::Reference< EncryptionData >& xEncryptionData, bool bEncrypt )
+uno::Reference< xml::crypto::XCipherContext > ZipFile::StaticGetCipher( const uno::Reference< uno::XComponentContext >& xArgContext, const ::rtl::Reference< EncryptionData >& xEncryptionData, bool bEncrypt )
{
uno::Reference< xml::crypto::XCipherContext > xResult;
@@ -169,13 +168,11 @@ uno::Reference< xml::crypto::XCipherContext > ZipFile::StaticGetCipher( const un
if ( xEncryptionData->m_nEncAlg == xml::crypto::CipherID::AES_CBC_W3C_PADDING )
{
- uno::Reference< lang::XMultiServiceFactory > xFactory = xArgFactory;
- if ( !xFactory.is() )
- xFactory.set( comphelper::getProcessServiceFactory(), uno::UNO_SET_THROW );
+ uno::Reference< uno::XComponentContext > xContext = xArgContext;
+ if ( !xContext.is() )
+ xContext = comphelper::getProcessComponentContext();
- uno::Reference< xml::crypto::XCipherContextSupplier > xCipherContextSupplier(
- xFactory->createInstance("com.sun.star.xml.crypto.NSSInitializer"),
- uno::UNO_QUERY_THROW );
+ uno::Reference< xml::crypto::XNSSInitializer > xCipherContextSupplier = xml::crypto::NSSInitializer::create( xContext );
xResult = xCipherContextSupplier->getCipherContext( xEncryptionData->m_nEncAlg, aDerivedKey, xEncryptionData->m_aInitVector, bEncrypt, uno::Sequence< beans::NamedValue >() );
}
@@ -381,7 +378,7 @@ sal_Bool ZipFile::StaticFillData ( ::rtl::Reference< BaseEncryptionData > & rDa
return bOk;
}
-uno::Reference< XInputStream > ZipFile::StaticGetDataFromRawStream( const uno::Reference< lang::XMultiServiceFactory >& xFactory,
+uno::Reference< XInputStream > ZipFile::StaticGetDataFromRawStream( const uno::Reference< uno::XComponentContext >& rxContext,
const uno::Reference< XInputStream >& xStream,
const ::rtl::Reference< EncryptionData > &rData )
throw ( packages::WrongPasswordException, ZipIOException, RuntimeException )
@@ -417,11 +414,11 @@ uno::Reference< XInputStream > ZipFile::StaticGetDataFromRawStream( const uno::R
xStream->readBytes( aReadBuffer, nSize );
- if ( !StaticHasValidPassword( xFactory, aReadBuffer, rData ) )
+ if ( !StaticHasValidPassword( rxContext, aReadBuffer, rData ) )
throw packages::WrongPasswordException(OSL_LOG_PREFIX, uno::Reference< uno::XInterface >() );
}
- return new XUnbufferedStream( xFactory, xStream, rData );
+ return new XUnbufferedStream( rxContext, xStream, rData );
}
#if 0
@@ -439,14 +436,14 @@ void CheckSequence( const uno::Sequence< sal_Int8 >& aSequence )
}
#endif
-sal_Bool ZipFile::StaticHasValidPassword( const uno::Reference< lang::XMultiServiceFactory >& xFactory, const Sequence< sal_Int8 > &aReadBuffer, const ::rtl::Reference< EncryptionData > &rData )
+sal_Bool ZipFile::StaticHasValidPassword( const uno::Reference< uno::XComponentContext >& rxContext, const Sequence< sal_Int8 > &aReadBuffer, const ::rtl::Reference< EncryptionData > &rData )
{
if ( !rData.is() || !rData->m_aKey.getLength() )
return sal_False;
sal_Bool bRet = sal_False;
- uno::Reference< xml::crypto::XCipherContext > xCipher( StaticGetCipher( xFactory, rData, false ), uno::UNO_SET_THROW );
+ uno::Reference< xml::crypto::XCipherContext > xCipher( StaticGetCipher( rxContext, rData, false ), uno::UNO_SET_THROW );
uno::Sequence< sal_Int8 > aDecryptBuffer;
uno::Sequence< sal_Int8 > aDecryptBuffer2;
@@ -472,7 +469,7 @@ sal_Bool ZipFile::StaticHasValidPassword( const uno::Reference< lang::XMultiServ
aDecryptBuffer.realloc( n_ConstDigestLength );
uno::Sequence< sal_Int8 > aDigestSeq;
- uno::Reference< xml::crypto::XDigestContext > xDigestContext( StaticGetDigestContextForChecksum( xFactory, rData ), uno::UNO_SET_THROW );
+ uno::Reference< xml::crypto::XDigestContext > xDigestContext( StaticGetDigestContextForChecksum( rxContext, rData ), uno::UNO_SET_THROW );
xDigestContext->updateDigest( aDecryptBuffer );
aDigestSeq = xDigestContext->finalizeDigestAndDispose();
@@ -510,7 +507,7 @@ sal_Bool ZipFile::hasValidPassword ( ZipEntry & rEntry, const ::rtl::Reference<
xStream->readBytes( aReadBuffer, nSize );
- bRet = StaticHasValidPassword( m_xFactory, aReadBuffer, rData );
+ bRet = StaticHasValidPassword( m_xContext, aReadBuffer, rData );
}
return bRet;
@@ -526,7 +523,7 @@ uno::Reference< XInputStream > ZipFile::createUnbufferedStream(
{
::osl::MutexGuard aGuard( m_aMutex );
- return new XUnbufferedStream ( m_xFactory, aMutexHolder, rEntry, xStream, rData, nStreamMode, bIsEncrypted, aMediaType, bRecoveryMode );
+ return new XUnbufferedStream ( m_xContext, aMutexHolder, rEntry, xStream, rData, nStreamMode, bIsEncrypted, aMediaType, bRecoveryMode );
}
diff --git a/package/source/zipapi/ZipOutputStream.cxx b/package/source/zipapi/ZipOutputStream.cxx
index df5c70ffbf67..f24881dfbb7a 100644
--- a/package/source/zipapi/ZipOutputStream.cxx
+++ b/package/source/zipapi/ZipOutputStream.cxx
@@ -40,9 +40,9 @@ using namespace com::sun::star::packages::zip::ZipConstants;
/** This class is used to write Zip files
*/
-ZipOutputStream::ZipOutputStream( const uno::Reference< lang::XMultiServiceFactory >& xFactory,
+ZipOutputStream::ZipOutputStream( const uno::Reference< uno::XComponentContext >& rxContext,
const uno::Reference < XOutputStream > &xOStream )
-: m_xFactory( xFactory )
+: m_xContext( rxContext )
, xStream(xOStream)
, m_aDeflateBuffer(n_ConstBufferSize)
, aDeflater(DEFAULT_COMPRESSION, sal_True)
@@ -96,8 +96,8 @@ void SAL_CALL ZipOutputStream::putNextEntry( ZipEntry& rEntry,
{
bEncryptCurrentEntry = sal_True;
- m_xCipherContext = ZipFile::StaticGetCipher( m_xFactory, pStream->GetEncryptionData(), true );
- m_xDigestContext = ZipFile::StaticGetDigestContextForChecksum( m_xFactory, pStream->GetEncryptionData() );
+ m_xCipherContext = ZipFile::StaticGetCipher( m_xContext, pStream->GetEncryptionData(), true );
+ m_xDigestContext = ZipFile::StaticGetDigestContextForChecksum( m_xContext, pStream->GetEncryptionData() );
mnDigested = 0;
rEntry.nFlag |= 1 << 4;
m_pCurrentStream = pStream;
diff --git a/package/source/zippackage/ZipPackage.cxx b/package/source/zippackage/ZipPackage.cxx
index b6b853d7bac2..f24774755a9e 100644
--- a/package/source/zippackage/ZipPackage.cxx
+++ b/package/source/zippackage/ZipPackage.cxx
@@ -753,7 +753,7 @@ void SAL_CALL ZipPackage::initialize( const uno::Sequence< Any >& aArguments )
{
try
{
- m_pZipFile = new ZipFile ( m_xContentStream, m_xFactory, sal_True, m_bForceRecovery, xProgressHandler );
+ m_pZipFile = new ZipFile ( m_xContentStream, comphelper::getComponentContext(m_xFactory), sal_True, m_bForceRecovery, xProgressHandler );
getZipFileContents();
}
catch ( IOException & )
@@ -1108,7 +1108,7 @@ void ZipPackage::ConnectTo( const uno::Reference< io::XInputStream >& xInStream
if ( m_pZipFile )
m_pZipFile->setInputStream( m_xContentStream );
else
- m_pZipFile = new ZipFile ( m_xContentStream, m_xFactory, sal_False );
+ m_pZipFile = new ZipFile ( m_xContentStream, comphelper::getComponentContext(m_xFactory), sal_False );
}
//--------------------------------------------------------
@@ -1157,7 +1157,7 @@ uno::Reference< io::XInputStream > ZipPackage::writeTempFile()
}
// Hand it to the ZipOutputStream:
- ZipOutputStream aZipOut( m_xFactory, xTempOut );
+ ZipOutputStream aZipOut( comphelper::getComponentContext(m_xFactory), xTempOut );
aZipOut.setMethod( DEFLATED );
aZipOut.setLevel( DEFAULT_COMPRESSION );
diff --git a/package/source/zippackage/ZipPackageStream.cxx b/package/source/zippackage/ZipPackageStream.cxx
index 7352b8c3d3e0..88afb2a3366a 100644
--- a/package/source/zippackage/ZipPackageStream.cxx
+++ b/package/source/zippackage/ZipPackageStream.cxx
@@ -564,7 +564,7 @@ uno::Reference< io::XInputStream > SAL_CALL ZipPackageStream::getDataStream()
return xResult;
}
else if ( m_nStreamMode == PACKAGE_STREAM_RAW )
- return ZipFile::StaticGetDataFromRawStream( m_xFactory, GetOwnSeekStream(), GetEncryptionData() );
+ return ZipFile::StaticGetDataFromRawStream( comphelper::getComponentContext(m_xFactory), GetOwnSeekStream(), GetEncryptionData() );
else if ( GetOwnSeekStream().is() )
{
return new WrapStreamForShare( GetOwnSeekStream(), rZipPackage.GetSharedMutexRef() );
diff --git a/package/source/zippackage/zipfileaccess.cxx b/package/source/zippackage/zipfileaccess.cxx
index 0ee088f6ffda..09a6e89d7fca 100644
--- a/package/source/zippackage/zipfileaccess.cxx
+++ b/package/source/zippackage/zipfileaccess.cxx
@@ -38,14 +38,14 @@
using namespace ::com::sun::star;
// ----------------------------------------------------------------
-OZipFileAccess::OZipFileAccess( const uno::Reference< lang::XMultiServiceFactory >& xFactory )
+OZipFileAccess::OZipFileAccess( const uno::Reference< uno::XComponentContext >& rxContext )
: m_aMutexHolder( new SotMutexHolder )
-, m_xFactory( xFactory )
+, m_xContext( rxContext )
, m_pZipFile( NULL )
, m_pListenersContainer( NULL )
, m_bDisposed( sal_False )
{
- if ( !xFactory.is() )
+ if ( !rxContext.is() )
throw uno::RuntimeException(OSL_LOG_PREFIX, uno::Reference< uno::XInterface >() );
}
@@ -188,7 +188,7 @@ void SAL_CALL OZipFileAccess::initialize( const uno::Sequence< uno::Any >& aArgu
::ucbhelper::Content aContent(
aParamURL,
uno::Reference< ::com::sun::star::ucb::XCommandEnvironment >(),
- comphelper::getComponentContext( m_xFactory ) );
+ m_xContext );
uno::Reference < io::XActiveDataSink > xSink = new ZipPackageSink;
if ( aContent.openStream ( xSink ) )
{
@@ -221,7 +221,7 @@ void SAL_CALL OZipFileAccess::initialize( const uno::Sequence< uno::Any >& aArgu
// TODO: in case xSeekable is implemented on separated XStream implementation a wrapper is required
m_pZipFile = new ZipFile(
m_xContentStream,
- m_xFactory,
+ m_xContext,
sal_True );
}
@@ -450,9 +450,9 @@ OUString SAL_CALL OZipFileAccess::impl_staticGetImplementationName()
//-------------------------------------------------------------------------
uno::Reference< uno::XInterface > SAL_CALL OZipFileAccess::impl_staticCreateSelfInstance(
- const uno::Reference< lang::XMultiServiceFactory >& xServiceManager )
+ const uno::Reference< lang::XMultiServiceFactory >& rxMSF )
{
- return uno::Reference< uno::XInterface >( *new OZipFileAccess( xServiceManager ) );
+ return uno::Reference< uno::XInterface >( *new OZipFileAccess( comphelper::getComponentContext(rxMSF) ) );
}
//-------------------------------------------------------------------------
diff --git a/ucb/source/ucp/webdav-neon/NeonSession.cxx b/ucb/source/ucp/webdav-neon/NeonSession.cxx
index 0d6f931d0635..3ac4700765a7 100644
--- a/ucb/source/ucp/webdav-neon/NeonSession.cxx
+++ b/ucb/source/ucp/webdav-neon/NeonSession.cxx
@@ -72,15 +72,13 @@ extern "C" {
#include <com/sun/star/security/XCertificateContainer.hpp>
#include <com/sun/star/ucb/Lock.hpp>
#include <com/sun/star/beans/NamedValue.hpp>
-#include <com/sun/star/xml/crypto/XSEInitializer.hpp>
+#include <com/sun/star/xml/crypto/SEInitializer.hpp>
#include <boost/bind.hpp>
using namespace com::sun::star;
using namespace webdav_ucp;
-#define SEINITIALIZER_COMPONENT "com.sun.star.xml.crypto.SEInitializer"
-
#ifndef EOL
# define EOL "\r\n"
#endif
@@ -436,10 +434,7 @@ extern "C" int NeonSession_CertificationNotify( void *userdata,
uno::Reference< xml::crypto::XSEInitializer > xSEInitializer;
try
{
- xSEInitializer = uno::Reference< xml::crypto::XSEInitializer >(
- pSession->getComponentContext()->getServiceManager()->createInstanceWithContext(
- SEINITIALIZER_COMPONENT, pSession->getComponentContext()),
- uno::UNO_QUERY );
+ xSEInitializer = xml::crypto::SEInitializer::create( pSession->getComponentContext() );
}
catch ( uno::Exception const & )
{
diff --git a/xmlsecurity/inc/xmlsecurity/xmlsignaturehelper.hxx b/xmlsecurity/inc/xmlsecurity/xmlsignaturehelper.hxx
index e8b371b0a7ee..03ef04831e89 100644
--- a/xmlsecurity/inc/xmlsecurity/xmlsignaturehelper.hxx
+++ b/xmlsecurity/inc/xmlsecurity/xmlsignaturehelper.hxx
@@ -112,7 +112,6 @@ private:
Link maStartVerifySignatureHdl;
private:
- void ImplCreateSEInitializer();
DECL_LINK( SignatureCreationResultListener, XMLSignatureCreationResult*);
DECL_LINK( SignatureVerifyResultListener, XMLSignatureVerifyResult* );
DECL_LINK( StartVerifySignatureElement, const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >* );
diff --git a/xmlsecurity/qa/certext/SanCertExt.cxx b/xmlsecurity/qa/certext/SanCertExt.cxx
index 9c76d01e2ed8..f223bfb4abcb 100644
--- a/xmlsecurity/qa/certext/SanCertExt.cxx
+++ b/xmlsecurity/qa/certext/SanCertExt.cxx
@@ -22,7 +22,7 @@
#include <com/sun/star/security/XSanExtension.hpp>
#include <com/sun/star/security/ExtAltNameType.hpp>
#include <com/sun/star/xml/crypto/XSecurityEnvironment.hpp>
-#include <com/sun/star/xml/crypto/XSEInitializer.hpp>
+#include <com/sun/star/xml/crypto/SEInitializer.hpp>
#include <com/sun/star/xml/crypto/XXMLSecurityContext.hpp>
#include <com/sun/star/security/XCertificate.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
@@ -44,7 +44,6 @@
using namespace com::sun::star;
#define OID_SUBJECT_ALTERNATIVE_NAME "2.5.29.17"
-#define SEINITIALIZER_COMPONENT "com.sun.star.xml.crypto.SEInitializer"
namespace {
@@ -129,8 +128,7 @@ namespace {
{
uno::Reference< uno::XComponentContext > context(connection_.getComponentContext(), uno::UNO_QUERY_THROW);
uno::Reference< lang::XMultiServiceFactory > factory(context->getServiceManager(), uno::UNO_QUERY_THROW);
- uno::Reference< xml::crypto::XSEInitializer > xSEInitializer(factory->createInstance(
- rtl::OUString::createFromAscii( SEINITIALIZER_COMPONENT )), uno::UNO_QUERY_THROW);
+ uno::Reference< xml::crypto::XSEInitializer > xSEInitializer = xml::crypto::SEInitializer::create(context);
uno::Reference< xml::crypto::XXMLSecurityContext > xSecurityContext(
xSEInitializer->createSecurityContext(rtl::OUString()));
return xSecurityContext->getSecurityEnvironment();
diff --git a/xmlsecurity/source/helper/xmlsignaturehelper.cxx b/xmlsecurity/source/helper/xmlsignaturehelper.cxx
index 163e5f600f37..ca9ef0662171 100644
--- a/xmlsecurity/source/helper/xmlsignaturehelper.cxx
+++ b/xmlsecurity/source/helper/xmlsignaturehelper.cxx
@@ -37,13 +37,11 @@
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/xml/sax/Parser.hpp>
#include <com/sun/star/xml/sax/Writer.hpp>
+#include <com/sun/star/xml/crypto/SEInitializer.hpp>
#include <tools/date.hxx>
#include <tools/time.hxx>
-/* SEInitializer component */
-#define SEINITIALIZER_COMPONENT "com.sun.star.xml.crypto.SEInitializer"
-
#define TAG_DOCUMENTSIGNATURES "document-signatures"
#define NS_DOCUMENTSIGNATURES "http://openoffice.org/2004/documentsignatures"
#define NS_DOCUMENTSIGNATURES_ODF_1_2 "urn:oasis:names:tc:opendocument:xmlns:digitalsignature:1.0"
@@ -68,7 +66,7 @@ bool XMLSignatureHelper::Init()
DBG_ASSERT( !mxSEInitializer.is(), "XMLSignatureHelper::Init - mxSEInitializer already set!" );
DBG_ASSERT( !mxSecurityContext.is(), "XMLSignatureHelper::Init - mxSecurityContext already set!" );
- ImplCreateSEInitializer();
+ mxSEInitializer = com::sun::star::xml::crypto::SEInitializer::create( mxCtx );
if ( mxSEInitializer.is() )
mxSecurityContext = mxSEInitializer->createSecurityContext( ::rtl::OUString() );
@@ -76,14 +74,6 @@ bool XMLSignatureHelper::Init()
return mxSecurityContext.is();
}
-void XMLSignatureHelper::ImplCreateSEInitializer()
-{
- rtl::OUString sSEInitializer( SEINITIALIZER_COMPONENT );
- uno::Reference< lang::XMultiComponentFactory > xMCF( mxCtx->getServiceManager() );
- mxSEInitializer = uno::Reference< com::sun::star::xml::crypto::XSEInitializer > (
- xMCF->createInstanceWithContext( sSEInitializer, mxCtx ), uno::UNO_QUERY );
-}
-
void XMLSignatureHelper::SetStorage(
const Reference < css::embed::XStorage >& rxStorage,
::rtl::OUString sODFVersion)
diff --git a/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx b/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx
index 29dadaf5b37e..b3dae01654da 100644
--- a/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx
+++ b/xmlsecurity/source/xmlsec/nss/nssinitializer.cxx
@@ -88,14 +88,14 @@ extern "C" void nsscrypto_finalize();
namespace
{
-bool nsscrypto_initialize( const css::uno::Reference< css::lang::XMultiServiceFactory > &xMSF, bool & out_nss_init );
+bool nsscrypto_initialize( const css::uno::Reference< css::uno::XComponentContext > &rxContext, bool & out_nss_init );
struct InitNSSInitialize
{
- css::uno::Reference< css::lang::XMultiServiceFactory > mxMSF;
+ css::uno::Reference< css::uno::XComponentContext > m_xContext;
- InitNSSInitialize( const css::uno::Reference< css::lang::XMultiServiceFactory > &xMSF )
- : mxMSF( xMSF )
+ InitNSSInitialize( const css::uno::Reference< css::uno::XComponentContext > &rxContext )
+ : m_xContext( rxContext )
{
}
@@ -103,7 +103,7 @@ struct InitNSSInitialize
{
static bool bInitialized = false;
bool bNSSInit = false;
- bInitialized = nsscrypto_initialize( mxMSF, bNSSInit );
+ bInitialized = nsscrypto_initialize( m_xContext, bNSSInit );
if (bNSSInit)
atexit(nsscrypto_finalize );
return & bInitialized;
@@ -167,7 +167,7 @@ void deleteRootsModule()
}
}
-::rtl::OString getMozillaCurrentProfile( const css::uno::Reference< css::lang::XMultiServiceFactory > &rxMSF )
+::rtl::OString getMozillaCurrentProfile( const css::uno::Reference< css::uno::XComponentContext > &rxContext )
{
// first, try to get the profile from "MOZILLA_CERTIFICATE_FOLDER"
const char* pEnv = getenv("MOZILLA_CERTIFICATE_FOLDER");
@@ -195,8 +195,7 @@ void deleteRootsModule()
mozilla::MozillaProductType_Mozilla };
int nProduct = SAL_N_ELEMENTS(productTypes);
- uno::Reference<uno::XInterface> xInstance = rxMSF->createInstance(
- "com.sun.star.mozilla.MozillaBootstrap");
+ uno::Reference<uno::XInterface> xInstance = rxContext->getServiceManager()->createInstanceWithContext("com.sun.star.mozilla.MozillaBootstrap", rxContext);
OSL_ENSURE( xInstance.is(), "failed to create instance" );
uno::Reference<mozilla::XMozillaBootstrap> xMozillaBootstrap
@@ -243,7 +242,7 @@ void deleteRootsModule()
//return true - whole initialization was successful
//param out_nss_init = true: at least the NSS initialization (NSS_InitReadWrite
//was successful and therefor NSS_Shutdown should be called when terminating.
-bool nsscrypto_initialize( const css::uno::Reference< css::lang::XMultiServiceFactory > &xMSF, bool & out_nss_init )
+bool nsscrypto_initialize( const css::uno::Reference< css::uno::XComponentContext > &rxContext, bool & out_nss_init )
{
bool return_value = true;
@@ -251,7 +250,7 @@ bool nsscrypto_initialize( const css::uno::Reference< css::lang::XMultiServiceFa
rtl::OString sCertDir;
#ifdef XMLSEC_CRYPTO_NSS
- sCertDir = getMozillaCurrentProfile(xMSF);
+ sCertDir = getMozillaCurrentProfile(rxContext);
#else
(void) xMSF;
#endif
@@ -389,8 +388,8 @@ extern "C" void nsscrypto_finalize()
} // namespace
ONSSInitializer::ONSSInitializer(
- const css::uno::Reference< css::lang::XMultiServiceFactory > &rxMSF)
- :mxMSF( rxMSF )
+ const css::uno::Reference< css::uno::XComponentContext > &rxContext)
+ :m_xContext( rxContext )
{
}
@@ -398,10 +397,10 @@ ONSSInitializer::~ONSSInitializer()
{
}
-bool ONSSInitializer::initNSS( const css::uno::Reference< css::lang::XMultiServiceFactory > &xMSF )
+bool ONSSInitializer::initNSS( const css::uno::Reference< css::uno::XComponentContext > &rxContext )
{
return *rtl_Instance< bool, InitNSSInitialize, ::osl::MutexGuard, GetNSSInitStaticMutex >
- ::create( InitNSSInitialize( xMSF ), GetNSSInitStaticMutex() );
+ ::create( InitNSSInitialize( rxContext ), GetNSSInitStaticMutex() );
}
css::uno::Reference< css::xml::crypto::XDigestContext > SAL_CALL ONSSInitializer::getDigestContext( ::sal_Int32 nDigestID, const css::uno::Sequence< css::beans::NamedValue >& aParams )
@@ -431,7 +430,7 @@ css::uno::Reference< css::xml::crypto::XDigestContext > SAL_CALL ONSSInitializer
throw css::lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unexpected arguments provided for digest creation." ) ), css::uno::Reference< css::uno::XInterface >(), 2 );
css::uno::Reference< css::xml::crypto::XDigestContext > xResult;
- if( initNSS( mxMSF ) )
+ if( initNSS( m_xContext ) )
{
PK11Context* pContext = PK11_CreateDigestContext( nNSSDigestID );
if ( pContext && PK11_DigestBegin( pContext ) == SECSuccess )
@@ -461,7 +460,7 @@ css::uno::Reference< css::xml::crypto::XCipherContext > SAL_CALL ONSSInitializer
throw css::lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unexpected cipher requested." ) ), css::uno::Reference< css::uno::XInterface >(), 1 );
css::uno::Reference< css::xml::crypto::XCipherContext > xResult;
- if( initNSS( mxMSF ) )
+ if( initNSS( m_xContext ) )
{
if ( aInitializationVector.getLength() != PK11_GetIVLength( nNSSCipherID ) )
throw css::lang::IllegalArgumentException( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Unexpected length of initialization vector." ) ), css::uno::Reference< css::uno::XInterface >(), 3 );
@@ -497,7 +496,7 @@ cssu::Sequence< rtl::OUString > SAL_CALL ONSSInitializer_getSupportedServiceName
cssu::Reference< cssu::XInterface > SAL_CALL ONSSInitializer_createInstance( const cssu::Reference< cssl::XMultiServiceFactory > & rSMgr)
throw( cssu::Exception )
{
- return (cppu::OWeakObject*) new ONSSInitializer( rSMgr );
+ return (cppu::OWeakObject*) new ONSSInitializer( comphelper::getComponentContext(rSMgr) );
}
/* XServiceInfo */
diff --git a/xmlsecurity/source/xmlsec/nss/nssinitializer.hxx b/xmlsecurity/source/xmlsec/nss/nssinitializer.hxx
index d88344b991fe..4e6197d0e923 100644
--- a/xmlsecurity/source/xmlsec/nss/nssinitializer.hxx
+++ b/xmlsecurity/source/xmlsec/nss/nssinitializer.hxx
@@ -20,33 +20,31 @@
#ifndef _NSSINITIALIZER_HXX
#define _NSSINITIALIZER_HXX
-#include <com/sun/star/xml/crypto/XDigestContextSupplier.hpp>
-#include <com/sun/star/xml/crypto/XCipherContextSupplier.hpp>
+#include <com/sun/star/xml/crypto/XNSSInitializer.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <cppuhelper/implbase3.hxx>
+#include <cppuhelper/implbase2.hxx>
#define NSS_SERVICE_NAME "com.sun.star.xml.crypto.NSSInitializer"
-class ONSSInitializer : public cppu::WeakImplHelper3
+class ONSSInitializer : public cppu::WeakImplHelper2
<
- ::com::sun::star::xml::crypto::XDigestContextSupplier,
- ::com::sun::star::xml::crypto::XCipherContextSupplier,
+ ::com::sun::star::xml::crypto::XNSSInitializer,
::com::sun::star::lang::XServiceInfo
>
{
protected:
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > mxMSF;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
ONSSInitializer()
{}
public:
- ONSSInitializer( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > &rxMSF );
+ ONSSInitializer( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > &rxContext );
virtual ~ONSSInitializer();
- bool initNSS( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > &xMSF );
+ bool initNSS( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > &rxContext );
/* XDigestContextSupplier */
virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::crypto::XDigestContext > SAL_CALL getDigestContext( ::sal_Int32 nDigestID, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& aParams ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
diff --git a/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx
index 53741dfae3eb..666e3490ba7f 100644
--- a/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx
+++ b/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx
@@ -39,6 +39,7 @@
#undef DEBUG_WAS_DEFINED
#endif
+#include <comphelper/processfactory.hxx>
#include <sal/types.h>
#include <rtl/bootstrap.hxx>
#include <rtl/string.hxx>
@@ -59,7 +60,6 @@
namespace css = ::com::sun::star;
-namespace cssu = css::uno;
namespace cssl = css::lang;
namespace cssxc = css::xml::crypto;
@@ -72,11 +72,9 @@ using ::rtl::OString;
#define SECURITY_ENVIRONMENT "com.sun.star.xml.crypto.SecurityEnvironment"
#define SECURITY_CONTEXT "com.sun.star.xml.crypto.XMLSecurityContext"
- int nProduct = 4;
-SEInitializer_NssImpl::SEInitializer_NssImpl(
- const css::uno::Reference< css::lang::XMultiServiceFactory > &rxMSF )
+SEInitializer_NssImpl::SEInitializer_NssImpl( const css::uno::Reference< css::uno::XComponentContext > &rxContext )
{
- mxMSF = rxMSF;
+ m_xContext = rxContext;
}
SEInitializer_NssImpl::~SEInitializer_NssImpl()
@@ -84,13 +82,13 @@ SEInitializer_NssImpl::~SEInitializer_NssImpl()
}
/* XSEInitializer */
-cssu::Reference< cssxc::XXMLSecurityContext > SAL_CALL
+uno::Reference< cssxc::XXMLSecurityContext > SAL_CALL
SEInitializer_NssImpl::createSecurityContext( const ::rtl::OUString& )
- throw (cssu::RuntimeException)
+ throw (uno::RuntimeException)
{
CERTCertDBHandle *pCertHandle = NULL ;
- if( !initNSS( mxMSF ) )
+ if( !initNSS( m_xContext ) )
return NULL;
pCertHandle = CERT_GetDefaultCertDB() ;
@@ -99,13 +97,13 @@ cssu::Reference< cssxc::XXMLSecurityContext > SAL_CALL
{
/* Build XML Security Context */
const rtl::OUString sSecyrutyContext ( RTL_CONSTASCII_USTRINGPARAM( SECURITY_CONTEXT ) );
- cssu::Reference< cssxc::XXMLSecurityContext > xSecCtx( mxMSF->createInstance ( sSecyrutyContext ), cssu::UNO_QUERY );
+ uno::Reference< cssxc::XXMLSecurityContext > xSecCtx( m_xContext->getServiceManager()->createInstanceWithContext(sSecyrutyContext, m_xContext), uno::UNO_QUERY );
if( !xSecCtx.is() )
return NULL;
const rtl::OUString sSecyrutyEnvironment ( RTL_CONSTASCII_USTRINGPARAM( SECURITY_ENVIRONMENT ) );
- cssu::Reference< cssxc::XSecurityEnvironment > xSecEnv( mxMSF->createInstance ( sSecyrutyEnvironment ), cssu::UNO_QUERY );
- cssu::Reference< cssl::XUnoTunnel > xEnvTunnel( xSecEnv , cssu::UNO_QUERY ) ;
+ uno::Reference< cssxc::XSecurityEnvironment > xSecEnv( m_xContext->getServiceManager()->createInstanceWithContext(sSecyrutyEnvironment, m_xContext), uno::UNO_QUERY );
+ uno::Reference< cssl::XUnoTunnel > xEnvTunnel( xSecEnv , uno::UNO_QUERY ) ;
if( !xEnvTunnel.is() )
return NULL;
SecurityEnvironment_NssImpl* pSecEnv = reinterpret_cast<SecurityEnvironment_NssImpl*>(
@@ -118,7 +116,7 @@ cssu::Reference< cssxc::XXMLSecurityContext > SAL_CALL
xSecCtx->setDefaultSecurityEnvironmentIndex( n );
return xSecCtx;
}
- catch( cssu::Exception& )
+ catch( const uno::Exception& )
{
//PK11_LogoutAll();
//NSS_Shutdown();
@@ -126,8 +124,8 @@ cssu::Reference< cssxc::XXMLSecurityContext > SAL_CALL
}
}
-void SAL_CALL SEInitializer_NssImpl::freeSecurityContext( const cssu::Reference< cssxc::XXMLSecurityContext >& )
- throw (cssu::RuntimeException)
+void SAL_CALL SEInitializer_NssImpl::freeSecurityContext( const uno::Reference< cssxc::XXMLSecurityContext >& )
+ throw (uno::RuntimeException)
{
/*
* because the security context will free all its content when it
@@ -139,47 +137,47 @@ void SAL_CALL SEInitializer_NssImpl::freeSecurityContext( const cssu::Reference<
}
rtl::OUString SEInitializer_NssImpl_getImplementationName ()
- throw (cssu::RuntimeException)
+ throw (uno::RuntimeException)
{
return rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( IMPLEMENTATION_NAME ) );
}
sal_Bool SAL_CALL SEInitializer_NssImpl_supportsService( const rtl::OUString& ServiceName )
- throw (cssu::RuntimeException)
+ throw (uno::RuntimeException)
{
return ( ServiceName == SE_SERVICE_NAME || ServiceName == NSS_SERVICE_NAME );
}
-cssu::Sequence< rtl::OUString > SAL_CALL SEInitializer_NssImpl_getSupportedServiceNames( )
- throw (cssu::RuntimeException)
+uno::Sequence< rtl::OUString > SAL_CALL SEInitializer_NssImpl_getSupportedServiceNames( )
+ throw (uno::RuntimeException)
{
- cssu::Sequence < rtl::OUString > aRet(2);
+ uno::Sequence < rtl::OUString > aRet(2);
rtl::OUString* pArray = aRet.getArray();
pArray[0] = rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( SE_SERVICE_NAME ) );
pArray[1] = rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( NSS_SERVICE_NAME ) );
return aRet;
}
-cssu::Reference< cssu::XInterface > SAL_CALL SEInitializer_NssImpl_createInstance( const cssu::Reference< cssl::XMultiServiceFactory > & rSMgr)
- throw( cssu::Exception )
+uno::Reference< uno::XInterface > SAL_CALL SEInitializer_NssImpl_createInstance( const uno::Reference< lang::XMultiServiceFactory > & rxMSF)
+ throw( uno::Exception )
{
- return (cppu::OWeakObject*) new SEInitializer_NssImpl(rSMgr);
+ return (cppu::OWeakObject*) new SEInitializer_NssImpl(comphelper::getComponentContext(rxMSF));
}
/* XServiceInfo */
rtl::OUString SAL_CALL SEInitializer_NssImpl::getImplementationName( )
- throw (cssu::RuntimeException)
+ throw (uno::RuntimeException)
{
return SEInitializer_NssImpl_getImplementationName();
}
sal_Bool SAL_CALL SEInitializer_NssImpl::supportsService( const rtl::OUString& rServiceName )
- throw (cssu::RuntimeException)
+ throw (uno::RuntimeException)
{
return SEInitializer_NssImpl_supportsService( rServiceName );
}
-cssu::Sequence< rtl::OUString > SAL_CALL SEInitializer_NssImpl::getSupportedServiceNames( )
- throw (cssu::RuntimeException)
+uno::Sequence< rtl::OUString > SAL_CALL SEInitializer_NssImpl::getSupportedServiceNames( )
+ throw (uno::RuntimeException)
{
return SEInitializer_NssImpl_getSupportedServiceNames();
}
diff --git a/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.hxx b/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.hxx
index 35e6f2f92367..f75f8dbb8e83 100644
--- a/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.hxx
+++ b/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.hxx
@@ -36,7 +36,7 @@ class SEInitializer_NssImpl : public cppu::ImplInheritanceHelper1
>
{
public:
- SEInitializer_NssImpl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > &rxMSF );
+ SEInitializer_NssImpl( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > &rxContext );
virtual ~SEInitializer_NssImpl();
/* XSEInitializer */
@@ -70,7 +70,7 @@ com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL SEInitializer_NssImpl_ge
throw ( ::com::sun::star::uno::RuntimeException );
com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >
-SAL_CALL SEInitializer_NssImpl_createInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr)
+SAL_CALL SEInitializer_NssImpl_createInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rxMSF)
throw ( ::com::sun::star::uno::Exception );
#endif