[PATCH] fdo#46808, Convert xml::crypto services to new style
Noel Grandin (via Code Review)
gerrit at gerrit.libreoffice.org
Wed Jun 5 05:49:14 PDT 2013
Hi,
I have submitted a patch for review:
https://gerrit.libreoffice.org/4165
To pull it, you can do:
git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/65/4165/1
fdo#46808, Convert xml::crypto services to new style
Change-Id: I81f32b2cdcf69b84fe4b15382f9294073a7f2f20
---
M offapi/UnoApi_offapi.mk
M offapi/com/sun/star/xml/crypto/SecurityEnvironment.idl
M offapi/com/sun/star/xml/crypto/XMLSecurityContext.idl
A offapi/com/sun/star/xml/crypto/XSecurityEnvironment2.idl
M xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.hxx
M xmlsecurity/source/xmlsec/mscrypt/seinitializer_mscryptimpl.cxx
M xmlsecurity/source/xmlsec/mscrypt/seinitializer_mscryptimpl.hxx
M xmlsecurity/source/xmlsec/mscrypt/xmlsecuritycontext_mscryptimpl.cxx
M xmlsecurity/source/xmlsec/mscrypt/xmlsecuritycontext_mscryptimpl.hxx
M xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
M xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.hxx
M xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx
M xmlsecurity/source/xmlsec/nss/xmlsecuritycontext_nssimpl.cxx
M xmlsecurity/source/xmlsec/nss/xmlsecuritycontext_nssimpl.hxx
14 files changed, 101 insertions(+), 114 deletions(-)
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index bd28407..bb74216 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -451,8 +451,10 @@
))
$(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/xml/crypto,\
NSSInitializer \
+ SecurityEnvironment \
SEInitializer \
XMLEncryptionTemplate \
+ XMLSecurityContext \
XMLSignatureTemplate \
))
$(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/xml/dom,\
@@ -1583,9 +1585,7 @@
XMLImportFilter \
))
$(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/xml/crypto,\
- SecurityEnvironment \
XMLEncryption \
- XMLSecurityContext \
XMLSignature \
))
$(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/xml/crypto/sax,\
@@ -4182,6 +4182,7 @@
XNSSInitializer \
XSEInitializer \
XSecurityEnvironment \
+ XSecurityEnvironment2 \
XUriBinding \
XXMLEncryption \
XXMLEncryptionTemplate \
diff --git a/offapi/com/sun/star/xml/crypto/SecurityEnvironment.idl b/offapi/com/sun/star/xml/crypto/SecurityEnvironment.idl
index 18d12a9..354fe3b 100644
--- a/offapi/com/sun/star/xml/crypto/SecurityEnvironment.idl
+++ b/offapi/com/sun/star/xml/crypto/SecurityEnvironment.idl
@@ -21,25 +21,17 @@
/** -- idl definition -- **/
-#ifndef __com_sun_star_xml_crypto_securityenvironment_idl_
-#define __com_sun_star_xml_crypto_securityenvironment_idl_
+#ifndef __com_sun_star_xml_crypto_SecurityEnvironment_idl_
+#define __com_sun_star_xml_crypto_SecurityEnvironment_idl_
-#include <com/sun/star/uno/XInterface.idl>
-#include <com/sun/star/uno/Exception.idl>
-#include <com/sun/star/xml/crypto/XSecurityEnvironment.idl>
-#include <com/sun/star/lang/XUnoTunnel.idl>
-#include <com/sun/star/lang/XInitialization.idl>
+#include <com/sun/star/xml/crypto/XSecurityEnvironment2.idl>
module com { module sun { module star { module xml { module crypto {
/**
* Service of XSecurityEnvironment
*/
-service SecurityEnvironment {
- interface com::sun::star::xml::crypto::XSecurityEnvironment ;
- interface com::sun::star::lang::XInitialization ;
- interface com::sun::star::lang::XUnoTunnel;
-} ;
+service SecurityEnvironment : XSecurityEnvironment2;
} ; } ; } ; } ; } ;
diff --git a/offapi/com/sun/star/xml/crypto/XMLSecurityContext.idl b/offapi/com/sun/star/xml/crypto/XMLSecurityContext.idl
index 90c3211..1d84197 100644
--- a/offapi/com/sun/star/xml/crypto/XMLSecurityContext.idl
+++ b/offapi/com/sun/star/xml/crypto/XMLSecurityContext.idl
@@ -21,23 +21,17 @@
/** -- idl definition -- **/
-#ifndef __com_sun_star_xml_crypto_xmlsecuritycontext_idl_
-#define __com_sun_star_xml_crypto_xmlsecuritycontext_idl_
+#ifndef __com_sun_star_xml_crypto_XMLSecurityContext_idl_
+#define __com_sun_star_xml_crypto_XMLSecurityContext_idl_
-#include <com/sun/star/uno/XInterface.idl>
-#include <com/sun/star/uno/Exception.idl>
#include <com/sun/star/xml/crypto/XXMLSecurityContext.idl>
-#include <com/sun/star/lang/XInitialization.idl>
module com { module sun { module star { module xml { module crypto {
/**
* Service of XMLSecurityContext
*/
-service XMLSecurityContext {
- interface com::sun::star::xml::crypto::XXMLSecurityContext ;
- interface com::sun::star::lang::XInitialization ;
-} ;
+service XMLSecurityContext : XXMLSecurityContext;
} ; } ; } ; } ; } ;
diff --git a/offapi/com/sun/star/xml/crypto/XSecurityEnvironment2.idl b/offapi/com/sun/star/xml/crypto/XSecurityEnvironment2.idl
new file mode 100644
index 0000000..6a63399
--- /dev/null
+++ b/offapi/com/sun/star/xml/crypto/XSecurityEnvironment2.idl
@@ -0,0 +1,47 @@
+/* -*- 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 .
+ */
+
+//i20156 - new file for XML security module
+
+/** -- idl definition -- **/
+
+#ifndef __com_sun_star_xml_crypto_XSecurityEnvironment2_idl_
+#define __com_sun_star_xml_crypto_XSecurityEnvironment2_idl_
+
+#include <com/sun/star/xml/crypto/XSecurityEnvironment.idl>
+#include <com/sun/star/lang/XUnoTunnel.idl>
+
+module com { module sun { module star { module xml { module crypto {
+
+/**
+ Unified interface for the SecurityEnvironment service.
+
+ @since LibreOffice 4.2
+ */
+interface XSecurityEnvironment2 {
+ interface com::sun::star::xml::crypto::XSecurityEnvironment;
+ interface com::sun::star::lang::XUnoTunnel;
+} ;
+
+} ; } ; } ; } ; } ;
+
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.hxx b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.hxx
index 5a5101a..baf79ea 100644
--- a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.hxx
+++ b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.hxx
@@ -31,7 +31,7 @@
#include <sal/config.h>
#include <rtl/ustring.hxx>
#include <cppuhelper/factory.hxx>
-#include <cppuhelper/implbase4.hxx>
+#include <cppuhelper/implbase3.hxx>
#include <com/sun/star/uno/Exception.hpp>
#include <com/sun/star/uno/Reference.hxx>
@@ -39,7 +39,7 @@
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
-#include <com/sun/star/xml/crypto/XSecurityEnvironment.hpp>
+#include <com/sun/star/xml/crypto/XSecurityEnvironment2.hpp>
#include <com/sun/star/security/XCertificate.hpp>
#include <com/sun/star/security/CertificateCharacters.hpp>
#include <com/sun/star/security/CertificateValidity.hpp>
@@ -51,11 +51,10 @@
#include "sal/types.h"
-class SecurityEnvironment_MSCryptImpl : public ::cppu::WeakImplHelper4<
- ::com::sun::star::xml::crypto::XSecurityEnvironment ,
+class SecurityEnvironment_MSCryptImpl : public ::cppu::WeakImplHelper3<
+ ::com::sun::star::xml::crypto::XSecurityEnvironment2 ,
::com::sun::star::lang::XInitialization ,
- ::com::sun::star::lang::XServiceInfo ,
- ::com::sun::star::lang::XUnoTunnel >
+ ::com::sun::star::lang::XServiceInfo >
{
private :
//cyrpto provider and key container
diff --git a/xmlsecurity/source/xmlsec/mscrypt/seinitializer_mscryptimpl.cxx b/xmlsecurity/source/xmlsec/mscrypt/seinitializer_mscryptimpl.cxx
index 36ea290..997ef44 100644
--- a/xmlsecurity/source/xmlsec/mscrypt/seinitializer_mscryptimpl.cxx
+++ b/xmlsecurity/source/xmlsec/mscrypt/seinitializer_mscryptimpl.cxx
@@ -24,6 +24,9 @@
#include "xmlsecurity/xmlsec-wrapper.h"
#include "xmlsec/mscrypto/app.h"
+#include "com/sun/star/xml/crypto/SecurityEnvironment.hpp"
+#include "com/sun/star/xml/crypto/XMLSecurityContext.hpp"
+#include "comphelper/processfactory.hxx"
namespace cssu = com::sun::star::uno;
namespace cssl = com::sun::star::lang;
@@ -31,12 +34,10 @@
#define SERVICE_NAME "com.sun.star.xml.crypto.SEInitializer"
#define IMPLEMENTATION_NAME "com.sun.star.xml.security.bridge.xmlsec.SEInitializer_MSCryptImpl"
-#define SECURITY_ENVIRONMENT "com.sun.star.xml.crypto.SecurityEnvironment"
-#define SECURITY_CONTEXT "com.sun.star.xml.crypto.XMLSecurityContext"
SEInitializer_MSCryptImpl::SEInitializer_MSCryptImpl(
- const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > &rxMSF)
- :mxMSF( rxMSF )
+ const com::sun::star::uno::Reference< com::sun::star::lang::XComponentContext > &rxContext)
+ :mxContext( rxContext )
{
}
@@ -74,33 +75,11 @@
try {
/* Build Security Environment */
- const OUString sSecyrutyEnvironment ( RTL_CONSTASCII_USTRINGPARAM( SECURITY_ENVIRONMENT ) );
- cssu::Reference< cssxc::XSecurityEnvironment > xSecEnv( mxMSF->createInstance ( sSecyrutyEnvironment ), cssu::UNO_QUERY );
- if( !xSecEnv.is() )
- {
- if( n_hStoreHandle != NULL )
- {
- CertCloseStore( n_hStoreHandle, CERT_CLOSE_STORE_FORCE_FLAG ) ;
- }
-
- xmlSecMSCryptoAppShutdown() ;
- return NULL;
- }
+ cssu::Reference< cssxc::XSecurityEnvironment2 > xSecEnv = cssxc::SecurityEnvironment::create( mxContext );
/* Setup key slot and certDb */
- cssu::Reference< cssl::XUnoTunnel > xEnvTunnel( xSecEnv , cssu::UNO_QUERY ) ;
- if( !xEnvTunnel.is() )
- {
- if( n_hStoreHandle != NULL )
- {
- CertCloseStore( n_hStoreHandle, CERT_CLOSE_STORE_FORCE_FLAG ) ;
- }
- xmlSecMSCryptoAppShutdown() ;
- return NULL;
- }
-
- SecurityEnvironment_MSCryptImpl* pSecEnv = ( SecurityEnvironment_MSCryptImpl* )xEnvTunnel->getSomething( SecurityEnvironment_MSCryptImpl::getUnoTunnelId() ) ;
+ SecurityEnvironment_MSCryptImpl* pSecEnv = ( SecurityEnvironment_MSCryptImpl* )xSecEnv->getSomething( SecurityEnvironment_MSCryptImpl::getUnoTunnelId() ) ;
if( pSecEnv == NULL )
{
if( n_hStoreHandle != NULL )
@@ -123,18 +102,7 @@
}
/* Build XML Security Context */
- const OUString sSecyrutyContext ( RTL_CONSTASCII_USTRINGPARAM( SECURITY_CONTEXT ) );
- cssu::Reference< cssxc::XXMLSecurityContext > xSecCtx( mxMSF->createInstance ( sSecyrutyContext ), cssu::UNO_QUERY );
- if( !xSecCtx.is() )
- {
- if( n_hStoreHandle != NULL )
- {
- CertCloseStore( n_hStoreHandle, CERT_CLOSE_STORE_FORCE_FLAG ) ;
- }
-
- xmlSecMSCryptoAppShutdown() ;
- return NULL;
- }
+ cssu::Reference< cssxc::XXMLSecurityContext > xSecCtx = cssxc::XMLSecurityContext::create( mxContext );
xSecCtx->setDefaultSecurityEnvironmentIndex(xSecCtx->addSecurityEnvironment( xSecEnv )) ;
return xSecCtx;
@@ -206,7 +174,7 @@
cssu::Reference< cssu::XInterface > SAL_CALL SEInitializer_MSCryptImpl_createInstance( const cssu::Reference< cssl::XMultiServiceFactory > & rSMgr)
throw( cssu::Exception )
{
- return (cppu::OWeakObject*) new SEInitializer_MSCryptImpl(rSMgr);
+ return (cppu::OWeakObject*) new SEInitializer_MSCryptImpl( comphelper::getComponentContext(rSMgr) );
}
/* XServiceInfo */
diff --git a/xmlsecurity/source/xmlsec/mscrypt/seinitializer_mscryptimpl.hxx b/xmlsecurity/source/xmlsec/mscrypt/seinitializer_mscryptimpl.hxx
index e622f93..eb81b7f 100644
--- a/xmlsecurity/source/xmlsec/mscrypt/seinitializer_mscryptimpl.hxx
+++ b/xmlsecurity/source/xmlsec/mscrypt/seinitializer_mscryptimpl.hxx
@@ -25,6 +25,7 @@
#include <com/sun/star/lang/XUnoTunnel.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
#include <cppuhelper/implbase2.hxx>
#include <libxml/tree.h>
@@ -51,10 +52,10 @@
******************************************************************************/
{
private:
- com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > mxMSF;
+ com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > mxContext;
public:
- SEInitializer_MSCryptImpl(const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > &rxMSF);
+ SEInitializer_MSCryptImpl(const com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext > &rxContext);
virtual ~SEInitializer_MSCryptImpl();
/* XSEInitializer */
diff --git a/xmlsecurity/source/xmlsec/mscrypt/xmlsecuritycontext_mscryptimpl.cxx b/xmlsecurity/source/xmlsec/mscrypt/xmlsecuritycontext_mscryptimpl.cxx
index fd67c7e..5ba26e6 100644
--- a/xmlsecurity/source/xmlsec/mscrypt/xmlsecuritycontext_mscryptimpl.cxx
+++ b/xmlsecurity/source/xmlsec/mscrypt/xmlsecuritycontext_mscryptimpl.cxx
@@ -34,9 +34,8 @@
using ::com::sun::star::xml::crypto::XSecurityEnvironment ;
using ::com::sun::star::xml::crypto::XXMLSecurityContext ;
-XMLSecurityContext_MSCryptImpl :: XMLSecurityContext_MSCryptImpl( const Reference< XMultiServiceFactory >& aFactory )
+XMLSecurityContext_MSCryptImpl :: XMLSecurityContext_MSCryptImpl()
://m_pKeysMngr( NULL ) ,
- m_xServiceManager( aFactory ),
m_xSecurityEnvironment( NULL )
{
//Init xmlsec library
@@ -156,8 +155,8 @@
}
//Helper for registry
-Reference< XInterface > SAL_CALL XMLSecurityContext_MSCryptImpl :: impl_createInstance( const Reference< XMultiServiceFactory >& aServiceManager ) throw( RuntimeException ) {
- return Reference< XInterface >( *new XMLSecurityContext_MSCryptImpl( aServiceManager ) ) ;
+Reference< XInterface > SAL_CALL XMLSecurityContext_MSCryptImpl :: impl_createInstance( const Reference< XMultiServiceFactory >& ) throw( RuntimeException ) {
+ return Reference< XInterface >( *new XMLSecurityContext_MSCryptImpl ) ;
}
Reference< XSingleServiceFactory > XMLSecurityContext_MSCryptImpl :: impl_createFactory( const Reference< XMultiServiceFactory >& aServiceManager ) {
diff --git a/xmlsecurity/source/xmlsec/mscrypt/xmlsecuritycontext_mscryptimpl.hxx b/xmlsecurity/source/xmlsec/mscrypt/xmlsecuritycontext_mscryptimpl.hxx
index 16416b8..4c60878 100644
--- a/xmlsecurity/source/xmlsec/mscrypt/xmlsecuritycontext_mscryptimpl.hxx
+++ b/xmlsecurity/source/xmlsec/mscrypt/xmlsecuritycontext_mscryptimpl.hxx
@@ -44,11 +44,10 @@
private :
//xmlSecKeysMngrPtr m_pKeysMngr ;
::com::sun::star::uno::Reference< ::com::sun::star::xml::crypto::XSecurityEnvironment > m_xSecurityEnvironment ;
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager ;
public :
- XMLSecurityContext_MSCryptImpl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& aFactory ) ;
- virtual ~XMLSecurityContext_MSCryptImpl() ;
+ XMLSecurityContext_MSCryptImpl();
+ virtual ~XMLSecurityContext_MSCryptImpl();
//Methods from XXMLSecurityContext
virtual sal_Int32 SAL_CALL addSecurityEnvironment(
diff --git a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
index 1d38b2a..5c8e894 100644
--- a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
+++ b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
@@ -118,7 +118,7 @@
return NULL;
}
-SecurityEnvironment_NssImpl :: SecurityEnvironment_NssImpl( const Reference< XMultiServiceFactory >& ) :
+SecurityEnvironment_NssImpl :: SecurityEnvironment_NssImpl() :
m_pHandler( NULL ) , m_tSymKeyList() , m_tPubKeyList() , m_tPriKeyList() {
PK11_SetPasswordFunc( GetPasswordFunction ) ;
@@ -194,8 +194,8 @@
}
//Helper for registry
-Reference< XInterface > SAL_CALL SecurityEnvironment_NssImpl :: impl_createInstance( const Reference< XMultiServiceFactory >& aServiceManager ) throw( RuntimeException ) {
- return Reference< XInterface >( *new SecurityEnvironment_NssImpl( aServiceManager ) ) ;
+Reference< XInterface > SAL_CALL SecurityEnvironment_NssImpl :: impl_createInstance( const Reference< XMultiServiceFactory >& ) throw( RuntimeException ) {
+ return Reference< XInterface >( *new SecurityEnvironment_NssImpl ) ;
}
Reference< XSingleServiceFactory > SecurityEnvironment_NssImpl :: impl_createFactory( const Reference< XMultiServiceFactory >& aServiceManager ) {
diff --git a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.hxx b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.hxx
index 4829099..cf60f07 100644
--- a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.hxx
+++ b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.hxx
@@ -23,7 +23,7 @@
#include <sal/config.h>
#include <rtl/ustring.hxx>
#include <cppuhelper/factory.hxx>
-#include <cppuhelper/implbase4.hxx>
+#include <cppuhelper/implbase3.hxx>
#include <com/sun/star/uno/Exception.hpp>
#include <com/sun/star/uno/Reference.hxx>
@@ -31,7 +31,7 @@
#include <com/sun/star/lang/XServiceInfo.hpp>
#include <com/sun/star/lang/XInitialization.hpp>
-#include <com/sun/star/xml/crypto/XSecurityEnvironment.hpp>
+#include <com/sun/star/xml/crypto/XSecurityEnvironment2.hpp>
#include <com/sun/star/security/XCertificate.hpp>
#include <com/sun/star/security/CertificateCharacters.hpp>
#include <com/sun/star/security/CertificateValidity.hpp>
@@ -46,11 +46,10 @@
#include "xmlsecurity/xmlsec-wrapper.h"
-class SecurityEnvironment_NssImpl : public ::cppu::WeakImplHelper4<
- ::com::sun::star::xml::crypto::XSecurityEnvironment ,
+class SecurityEnvironment_NssImpl : public ::cppu::WeakImplHelper3<
+ ::com::sun::star::xml::crypto::XSecurityEnvironment2 ,
::com::sun::star::lang::XInitialization ,
- ::com::sun::star::lang::XServiceInfo ,
- ::com::sun::star::lang::XUnoTunnel >
+ ::com::sun::star::lang::XServiceInfo >
{
private :
@@ -66,8 +65,8 @@
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager ;
public :
- SecurityEnvironment_NssImpl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& aFactory ) ;
- virtual ~SecurityEnvironment_NssImpl() ;
+ SecurityEnvironment_NssImpl();
+ virtual ~SecurityEnvironment_NssImpl();
//Methods from XSecurityEnvironment
@@ -113,7 +112,7 @@
static const ::com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelId() ;
- //Native mehtods
+ //Native methods
virtual CERTCertDBHandle* getCertDb() throw( ::com::sun::star::uno::Exception , ::com::sun::star::uno::RuntimeException ) ;
virtual void setCertDb( CERTCertDBHandle* aCertDb ) throw( ::com::sun::star::uno::Exception , ::com::sun::star::uno::RuntimeException ) ;
@@ -141,7 +140,7 @@
virtual ::com::sun::star::uno::Reference< ::com::sun::star::security::XCertificate > SAL_CALL createCertificateFromAscii( const OUString& asciiCertificate ) throw( ::com::sun::star::uno::SecurityException , ::com::sun::star::uno::RuntimeException ) ;
- //Native mehtods
+ //Native methods
virtual xmlSecKeysMngrPtr createKeysManager() throw( ::com::sun::star::uno::Exception , ::com::sun::star::uno::RuntimeException ) ;
virtual void destroyKeysManager(xmlSecKeysMngrPtr pKeysMngr) throw( ::com::sun::star::uno::Exception , ::com::sun::star::uno::RuntimeException ) ;
diff --git a/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx
index 015f656..6a7f3c8 100644
--- a/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx
+++ b/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx
@@ -33,6 +33,8 @@
#include <osl/file.hxx>
#include <osl/thread.h>
#include <rtl/logfile.hxx>
+#include <com/sun/star/xml/crypto/SecurityEnvironment.hpp>
+#include <com/sun/star/xml/crypto/XMLSecurityContext.hpp>
#include "seinitializer_nssimpl.hxx"
#include "securityenvironment_nssimpl.hxx"
@@ -51,9 +53,6 @@
using namespace com::sun::star;
#define SE_SERVICE_NAME "com.sun.star.xml.crypto.SEInitializer"
-#define IMPLEMENTATION_NAME "com.sun.star.xml.security.bridge.xmlsec.SEInitializer_NssImpl"
-#define SECURITY_ENVIRONMENT "com.sun.star.xml.crypto.SecurityEnvironment"
-#define SECURITY_CONTEXT "com.sun.star.xml.crypto.XMLSecurityContext"
SEInitializer_NssImpl::SEInitializer_NssImpl( const css::uno::Reference< css::uno::XComponentContext > &rxContext )
{
@@ -79,19 +78,12 @@
try
{
/* Build XML Security Context */
- const OUString sSecyrutyContext ( SECURITY_CONTEXT );
- uno::Reference< cssxc::XXMLSecurityContext > xSecCtx( m_xContext->getServiceManager()->createInstanceWithContext(sSecyrutyContext, m_xContext), uno::UNO_QUERY );
- if( !xSecCtx.is() )
- return NULL;
+ uno::Reference< cssxc::XXMLSecurityContext > xSecCtx = cssxc::XMLSecurityContext::create( m_xContext );
- const OUString sSecyrutyEnvironment ( SECURITY_ENVIRONMENT );
- 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;
+ uno::Reference< cssxc::XSecurityEnvironment2 > xSecEnv = cssxc::SecurityEnvironment::create( m_xContext );
SecurityEnvironment_NssImpl* pSecEnv = reinterpret_cast<SecurityEnvironment_NssImpl*>(
sal::static_int_cast<sal_uIntPtr>(
- xEnvTunnel->getSomething(SecurityEnvironment_NssImpl::getUnoTunnelId() ))) ;
+ xSecEnv->getSomething(SecurityEnvironment_NssImpl::getUnoTunnelId() ))) ;
pSecEnv->setCertDb(pCertHandle);
sal_Int32 n = xSecCtx->addSecurityEnvironment(xSecEnv);
@@ -122,8 +114,7 @@
OUString SEInitializer_NssImpl_getImplementationName ()
throw (uno::RuntimeException)
{
-
- return OUString ( IMPLEMENTATION_NAME );
+ return OUString ("com.sun.star.xml.security.bridge.xmlsec.SEInitializer_NssImpl" );
}
sal_Bool SAL_CALL SEInitializer_NssImpl_supportsService( const OUString& ServiceName )
diff --git a/xmlsecurity/source/xmlsec/nss/xmlsecuritycontext_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/xmlsecuritycontext_nssimpl.cxx
index cd3c863..f74b76d 100644
--- a/xmlsecurity/source/xmlsec/nss/xmlsecuritycontext_nssimpl.cxx
+++ b/xmlsecurity/source/xmlsec/nss/xmlsecuritycontext_nssimpl.cxx
@@ -34,9 +34,8 @@
using ::com::sun::star::xml::crypto::XSecurityEnvironment ;
using ::com::sun::star::xml::crypto::XXMLSecurityContext ;
-XMLSecurityContext_NssImpl :: XMLSecurityContext_NssImpl( const Reference< XMultiServiceFactory >& aFactory )
+XMLSecurityContext_NssImpl :: XMLSecurityContext_NssImpl()
://i39448 : m_pKeysMngr( NULL ) ,
- m_xServiceManager( aFactory ) ,
m_nDefaultEnvIndex(-1)
//m_xSecurityEnvironment( NULL )
{
@@ -169,8 +168,8 @@
}
//Helper for registry
-Reference< XInterface > SAL_CALL XMLSecurityContext_NssImpl :: impl_createInstance( const Reference< XMultiServiceFactory >& aServiceManager ) throw( RuntimeException ) {
- return Reference< XInterface >( *new XMLSecurityContext_NssImpl( aServiceManager ) ) ;
+Reference< XInterface > SAL_CALL XMLSecurityContext_NssImpl :: impl_createInstance( const Reference< XMultiServiceFactory >& ) throw( RuntimeException ) {
+ return Reference< XInterface >( *new XMLSecurityContext_NssImpl ) ;
}
Reference< XSingleServiceFactory > XMLSecurityContext_NssImpl :: impl_createFactory( const Reference< XMultiServiceFactory >& aServiceManager ) {
diff --git a/xmlsecurity/source/xmlsec/nss/xmlsecuritycontext_nssimpl.hxx b/xmlsecurity/source/xmlsec/nss/xmlsecuritycontext_nssimpl.hxx
index 9e9928a..f2a3b5c 100644
--- a/xmlsecurity/source/xmlsec/nss/xmlsecuritycontext_nssimpl.hxx
+++ b/xmlsecurity/source/xmlsec/nss/xmlsecuritycontext_nssimpl.hxx
@@ -47,12 +47,10 @@
//::com::sun::star::uno::Reference< ::com::sun::star::xml::crypto::XSecurityEnvironment > m_xSecurityEnvironment ;
std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::xml::crypto::XSecurityEnvironment > > m_vSecurityEnvironments;
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager ;
-
sal_Int32 m_nDefaultEnvIndex;
public :
- XMLSecurityContext_NssImpl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& aFactory ) ;
+ XMLSecurityContext_NssImpl() ;
virtual ~XMLSecurityContext_NssImpl() ;
//Methods from XXMLSecurityContext
--
To view, visit https://gerrit.libreoffice.org/4165
To unsubscribe, visit https://gerrit.libreoffice.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I81f32b2cdcf69b84fe4b15382f9294073a7f2f20
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Noel Grandin <noelgrandin at gmail.com>
More information about the LibreOffice
mailing list