diff options
author | Noel Grandin <noel@peralex.com> | 2013-06-05 13:30:21 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2013-06-10 10:20:44 +0200 |
commit | 670e2329df5cccaacd0e43d3656aeb112488e8ef (patch) | |
tree | aad439837c3d5e1770aa0c42314c18ca772dbdf4 /xmlsecurity/source | |
parent | 2c64af529567324f4433984ed7673304d26062c8 (diff) |
fdo#46808, Convert xml::crypto services to new style
Also remove the unnecessary XInitialization implementations.
Change-Id: I81f32b2cdcf69b84fe4b15382f9294073a7f2f20
Diffstat (limited to 'xmlsecurity/source')
19 files changed, 65 insertions, 207 deletions
diff --git a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx index ef23b20116de..066fd34cd948 100644 --- a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx +++ b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx @@ -174,11 +174,6 @@ SecurityEnvironment_MSCryptImpl :: ~SecurityEnvironment_MSCryptImpl() { } -/* XInitialization */ -void SAL_CALL SecurityEnvironment_MSCryptImpl :: initialize( const Sequence< Any >& /*aArguments*/ ) throw( Exception, RuntimeException ) { - //TODO -} ; - /* XServiceInfo */ OUString SAL_CALL SecurityEnvironment_MSCryptImpl :: getImplementationName() throw( RuntimeException ) { return impl_getImplementationName() ; diff --git a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.hxx b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.hxx index 5a5101affe45..ef8d77e9a6be 100644 --- a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.hxx +++ b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.hxx @@ -31,14 +31,13 @@ #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> #include <com/sun/star/lang/XSingleServiceFactory.hpp> #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/security/XCertificate.hpp> #include <com/sun/star/security/CertificateCharacters.hpp> @@ -51,10 +50,9 @@ #include "sal/types.h" -class SecurityEnvironment_MSCryptImpl : public ::cppu::WeakImplHelper4< +class SecurityEnvironment_MSCryptImpl : public ::cppu::WeakImplHelper3< ::com::sun::star::xml::crypto::XSecurityEnvironment , - ::com::sun::star::lang::XInitialization , - ::com::sun::star::lang::XServiceInfo , + ::com::sun::star::lang::XServiceInfo, ::com::sun::star::lang::XUnoTunnel > { private : @@ -129,11 +127,6 @@ class SecurityEnvironment_MSCryptImpl : public ::cppu::WeakImplHelper4< throw (::com::sun::star::uno::RuntimeException); - //Methods from XInitialization - virtual void SAL_CALL initialize( - const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments - ) throw( ::com::sun::star::uno::Exception , ::com::sun::star::uno::RuntimeException ) ; - //Methods from XServiceInfo virtual OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException ) ; diff --git a/xmlsecurity/source/xmlsec/mscrypt/seinitializer_mscryptimpl.cxx b/xmlsecurity/source/xmlsec/mscrypt/seinitializer_mscryptimpl.cxx index 36ea2903ae1b..af584e2f1602 100644 --- a/xmlsecurity/source/xmlsec/mscrypt/seinitializer_mscryptimpl.cxx +++ b/xmlsecurity/source/xmlsec/mscrypt/seinitializer_mscryptimpl.cxx @@ -24,19 +24,17 @@ #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; namespace cssxc = com::sun::star::xml::crypto; -#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 cssu::Reference< cssu::XComponentContext > &rxContext) + :mxContext( rxContext ) { } @@ -74,33 +72,11 @@ cssu::Reference< cssxc::XXMLSecurityContext > SAL_CALL 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::XSecurityEnvironment > 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() ) ; + cssu::Reference< cssl::XUnoTunnel > xSecEnvTunnel( xSecEnv, cssu::UNO_QUERY_THROW ); + SecurityEnvironment_MSCryptImpl* pSecEnv = ( SecurityEnvironment_MSCryptImpl* )xSecEnvTunnel->getSomething( SecurityEnvironment_MSCryptImpl::getUnoTunnelId() ) ; if( pSecEnv == NULL ) { if( n_hStoreHandle != NULL ) @@ -123,18 +99,7 @@ cssu::Reference< cssxc::XXMLSecurityContext > SAL_CALL } /* 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; @@ -181,46 +146,47 @@ void SAL_CALL SEInitializer_MSCryptImpl::freeSecurityContext( const cssu::Refere xmlSecMSCryptoAppShutdown() ; } -OUString SEInitializer_MSCryptImpl_getImplementationName () +OUString SEInitializer_MSCryptImpl_getImplementationName() throw (cssu::RuntimeException) { - return OUString ( RTL_CONSTASCII_USTRINGPARAM ( IMPLEMENTATION_NAME ) ); + return OUString( "com.sun.star.xml.security.bridge.xmlsec.SEInitializer_MSCryptImpl" ); } -sal_Bool SAL_CALL SEInitializer_MSCryptImpl_supportsService( const OUString& ServiceName ) +sal_Bool SAL_CALL SEInitializer_MSCryptImpl_supportsService( const OUString& rServiceName ) throw (cssu::RuntimeException) { - return ServiceName == SERVICE_NAME; + return rServiceName == "com.sun.star.xml.crypto.SEInitializer"; } -cssu::Sequence< OUString > SAL_CALL SEInitializer_MSCryptImpl_getSupportedServiceNames( ) +cssu::Sequence< OUString > SAL_CALL SEInitializer_MSCryptImpl_getSupportedServiceNames() throw (cssu::RuntimeException) { cssu::Sequence < OUString > aRet(1); OUString* pArray = aRet.getArray(); - pArray[0] = OUString ( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME ) ); + pArray[0] = OUString( "com.sun.star.xml.crypto.SEInitializer" ); return aRet; } -#undef SERVICE_NAME 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 */ -OUString SAL_CALL SEInitializer_MSCryptImpl::getImplementationName( ) +OUString SAL_CALL SEInitializer_MSCryptImpl::getImplementationName() throw (cssu::RuntimeException) { return SEInitializer_MSCryptImpl_getImplementationName(); } + sal_Bool SAL_CALL SEInitializer_MSCryptImpl::supportsService( const OUString& rServiceName ) throw (cssu::RuntimeException) { return SEInitializer_MSCryptImpl_supportsService( rServiceName ); } -cssu::Sequence< OUString > SAL_CALL SEInitializer_MSCryptImpl::getSupportedServiceNames( ) + +cssu::Sequence< OUString > SAL_CALL SEInitializer_MSCryptImpl::getSupportedServiceNames() throw (cssu::RuntimeException) { return SEInitializer_MSCryptImpl_getSupportedServiceNames(); diff --git a/xmlsecurity/source/xmlsec/mscrypt/seinitializer_mscryptimpl.hxx b/xmlsecurity/source/xmlsec/mscrypt/seinitializer_mscryptimpl.hxx index e622f933f3be..eb81b7fa0f5b 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 @@ class SEInitializer_MSCryptImpl : public cppu::WeakImplHelper2 ******************************************************************************/ { 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/xmlencryption_mscryptimpl.cxx b/xmlsecurity/source/xmlsec/mscrypt/xmlencryption_mscryptimpl.cxx index 5020c2c71597..c5117b7ec3ac 100644 --- a/xmlsecurity/source/xmlsec/mscrypt/xmlencryption_mscryptimpl.cxx +++ b/xmlsecurity/source/xmlsec/mscrypt/xmlencryption_mscryptimpl.cxx @@ -318,11 +318,6 @@ XMLEncryption_MSCryptImpl :: decrypt( return aTemplate; } -/* XInitialization */ -void SAL_CALL XMLEncryption_MSCryptImpl :: initialize( const Sequence< Any >& /*aArguments*/ ) throw( Exception, RuntimeException ) { - // TBD -} ; - /* XServiceInfo */ OUString SAL_CALL XMLEncryption_MSCryptImpl :: getImplementationName() throw( RuntimeException ) { return impl_getImplementationName() ; diff --git a/xmlsecurity/source/xmlsec/mscrypt/xmlencryption_mscryptimpl.hxx b/xmlsecurity/source/xmlsec/mscrypt/xmlencryption_mscryptimpl.hxx index 80fe3ff1971a..56d238daf1dd 100644 --- a/xmlsecurity/source/xmlsec/mscrypt/xmlencryption_mscryptimpl.hxx +++ b/xmlsecurity/source/xmlsec/mscrypt/xmlencryption_mscryptimpl.hxx @@ -23,21 +23,19 @@ #include <sal/config.h> #include <rtl/ustring.hxx> #include <cppuhelper/factory.hxx> -#include <cppuhelper/implbase3.hxx> +#include <cppuhelper/implbase2.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/lang/XInitialization.hpp> #include <com/sun/star/xml/crypto/XXMLEncryption.hpp> #include <com/sun/star/xml/crypto/XXMLEncryptionTemplate.hpp> #include <com/sun/star/xml/crypto/XXMLSecurityContext.hpp> -class XMLEncryption_MSCryptImpl : public ::cppu::WeakImplHelper3< +class XMLEncryption_MSCryptImpl : public ::cppu::WeakImplHelper2< ::com::sun::star::xml::crypto::XXMLEncryption , - ::com::sun::star::lang::XInitialization , ::com::sun::star::lang::XServiceInfo > { private : @@ -61,11 +59,6 @@ class XMLEncryption_MSCryptImpl : public ::cppu::WeakImplHelper3< ) throw( com::sun::star::xml::crypto::XMLEncryptionException , com::sun::star::uno::SecurityException) ; - //Methods from XInitialization - virtual void SAL_CALL initialize( - const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments - ) throw( ::com::sun::star::uno::Exception , ::com::sun::star::uno::RuntimeException ) ; - //Methods from XServiceInfo virtual OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException ) ; diff --git a/xmlsecurity/source/xmlsec/mscrypt/xmlsecuritycontext_mscryptimpl.cxx b/xmlsecurity/source/xmlsec/mscrypt/xmlsecuritycontext_mscryptimpl.cxx index fd67c7e3997c..599bd0a178f8 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::lang::XSingleServiceFactory ; 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 @@ -117,11 +116,6 @@ void SAL_CALL XMLSecurityContext_MSCryptImpl::setDefaultSecurityEnvironmentIndex //dummy } -/* XInitialization */ -void SAL_CALL XMLSecurityContext_MSCryptImpl :: initialize( const Sequence< Any >& /*aArguments*/ ) throw( Exception, RuntimeException ) { - // TBD -} ; - /* XServiceInfo */ OUString SAL_CALL XMLSecurityContext_MSCryptImpl :: getImplementationName() throw( RuntimeException ) { return impl_getImplementationName() ; @@ -156,8 +150,8 @@ OUString XMLSecurityContext_MSCryptImpl :: impl_getImplementationName() throw( R } //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 16416b8cf93b..aee4d17007e4 100644 --- a/xmlsecurity/source/xmlsec/mscrypt/xmlsecuritycontext_mscryptimpl.hxx +++ b/xmlsecurity/source/xmlsec/mscrypt/xmlsecuritycontext_mscryptimpl.hxx @@ -23,32 +23,29 @@ #include <sal/config.h> #include <rtl/ustring.hxx> #include <cppuhelper/factory.hxx> -#include <cppuhelper/implbase3.hxx> +#include <cppuhelper/implbase2.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/lang/XInitialization.hpp> #include <com/sun/star/lang/XUnoTunnel.hpp> #include <com/sun/star/xml/crypto/XSecurityEnvironment.hpp> #include <com/sun/star/xml/crypto/XXMLSecurityContext.hpp> -class XMLSecurityContext_MSCryptImpl : public ::cppu::WeakImplHelper3< +class XMLSecurityContext_MSCryptImpl : public ::cppu::WeakImplHelper2< ::com::sun::star::xml::crypto::XXMLSecurityContext , - ::com::sun::star::lang::XInitialization , ::com::sun::star::lang::XServiceInfo > { 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( @@ -75,11 +72,6 @@ class XMLSecurityContext_MSCryptImpl : public ::cppu::WeakImplHelper3< throw (::com::sun::star::uno::RuntimeException); - //Methods from XInitialization - virtual void SAL_CALL initialize( - const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments - ) throw( ::com::sun::star::uno::Exception , ::com::sun::star::uno::RuntimeException ) ; - //Methods from XServiceInfo virtual OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException ) ; diff --git a/xmlsecurity/source/xmlsec/mscrypt/xmlsignature_mscryptimpl.cxx b/xmlsecurity/source/xmlsec/mscrypt/xmlsignature_mscryptimpl.cxx index 2f3907ab3411..9e908639e0e6 100644 --- a/xmlsecurity/source/xmlsec/mscrypt/xmlsignature_mscryptimpl.cxx +++ b/xmlsecurity/source/xmlsec/mscrypt/xmlsignature_mscryptimpl.cxx @@ -248,11 +248,6 @@ SAL_CALL XMLSignature_MSCryptImpl :: validate( return aTemplate; } -/* XInitialization */ -void SAL_CALL XMLSignature_MSCryptImpl :: initialize( const Sequence< Any >& /*aArguments*/ ) throw( Exception, RuntimeException ) { - // TBD -} ; - /* XServiceInfo */ OUString SAL_CALL XMLSignature_MSCryptImpl :: getImplementationName() throw( RuntimeException ) { return impl_getImplementationName() ; diff --git a/xmlsecurity/source/xmlsec/mscrypt/xmlsignature_mscryptimpl.hxx b/xmlsecurity/source/xmlsec/mscrypt/xmlsignature_mscryptimpl.hxx index 3d231ad41254..ba9a6f545f34 100644 --- a/xmlsecurity/source/xmlsec/mscrypt/xmlsignature_mscryptimpl.hxx +++ b/xmlsecurity/source/xmlsec/mscrypt/xmlsignature_mscryptimpl.hxx @@ -23,21 +23,19 @@ #include <sal/config.h> #include <rtl/ustring.hxx> #include <cppuhelper/factory.hxx> -#include <cppuhelper/implbase3.hxx> +#include <cppuhelper/implbase2.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/lang/XInitialization.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::WeakImplHelper3< +class XMLSignature_MSCryptImpl : public ::cppu::WeakImplHelper2< ::com::sun::star::xml::crypto::XXMLSignature , - ::com::sun::star::lang::XInitialization , ::com::sun::star::lang::XServiceInfo > { private : @@ -61,11 +59,6 @@ class XMLSignature_MSCryptImpl : public ::cppu::WeakImplHelper3< com::sun::star::uno::SecurityException, com::sun::star::xml::crypto::XMLSignatureException); - //Methods from XInitialization - virtual void SAL_CALL initialize( - const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments - ) throw( ::com::sun::star::uno::Exception , ::com::sun::star::uno::RuntimeException ) ; - //Methods from XServiceInfo virtual OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException ) ; diff --git a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx index 1d38b2a5f15f..08c020d810d2 100644 --- a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx +++ b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx @@ -118,7 +118,7 @@ char* GetPasswordFunction( PK11SlotInfo* pSlot, PRBool bRetry, void* /*arg*/ ) 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 ) ; @@ -155,11 +155,6 @@ SecurityEnvironment_NssImpl :: ~SecurityEnvironment_NssImpl() { } } -/* XInitialization */ -void SAL_CALL SecurityEnvironment_NssImpl :: initialize( const Sequence< Any >& ) throw( Exception, RuntimeException ) { - // TBD -} ; - /* XServiceInfo */ OUString SAL_CALL SecurityEnvironment_NssImpl :: getImplementationName() throw( RuntimeException ) { return impl_getImplementationName() ; @@ -194,8 +189,8 @@ OUString SecurityEnvironment_NssImpl :: impl_getImplementationName() throw( Runt } //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 482909936a91..cefc23f2f21c 100644 --- a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.hxx +++ b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.hxx @@ -23,14 +23,13 @@ #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> #include <com/sun/star/lang/XSingleServiceFactory.hpp> #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/security/XCertificate.hpp> #include <com/sun/star/security/CertificateCharacters.hpp> @@ -46,10 +45,9 @@ #include "xmlsecurity/xmlsec-wrapper.h" -class SecurityEnvironment_NssImpl : public ::cppu::WeakImplHelper4< +class SecurityEnvironment_NssImpl : public ::cppu::WeakImplHelper3< ::com::sun::star::xml::crypto::XSecurityEnvironment , - ::com::sun::star::lang::XInitialization , - ::com::sun::star::lang::XServiceInfo , + ::com::sun::star::lang::XServiceInfo, ::com::sun::star::lang::XUnoTunnel > { private : @@ -66,16 +64,11 @@ private : ::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 - //Methods from XInitialization - virtual void SAL_CALL initialize( - const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments - ) throw( ::com::sun::star::uno::Exception , ::com::sun::star::uno::RuntimeException ) ; - //Methods from XServiceInfo virtual OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException ) ; @@ -113,7 +106,7 @@ private : 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 +134,7 @@ private : 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 015f6560ecfb..41c2378c698c 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 @@ namespace cssxc = css::xml::crypto; 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,13 @@ uno::Reference< cssxc::XXMLSecurityContext > SAL_CALL 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; - - 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::XXMLSecurityContext > xSecCtx = cssxc::XMLSecurityContext::create( m_xContext ); + + uno::Reference< cssxc::XSecurityEnvironment > xSecEnv = cssxc::SecurityEnvironment::create( m_xContext ); + uno::Reference< lang::XUnoTunnel > xSecEnvTunnel(xSecEnv, uno::UNO_QUERY_THROW); SecurityEnvironment_NssImpl* pSecEnv = reinterpret_cast<SecurityEnvironment_NssImpl*>( sal::static_int_cast<sal_uIntPtr>( - xEnvTunnel->getSomething(SecurityEnvironment_NssImpl::getUnoTunnelId() ))) ; + xSecEnvTunnel->getSomething(SecurityEnvironment_NssImpl::getUnoTunnelId() ))) ; pSecEnv->setCertDb(pCertHandle); sal_Int32 n = xSecCtx->addSecurityEnvironment(xSecEnv); @@ -122,8 +115,7 @@ void SAL_CALL SEInitializer_NssImpl::freeSecurityContext( const uno::Reference< 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/xmlencryption_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/xmlencryption_nssimpl.cxx index ff797df81d67..86d6c80c319e 100644 --- a/xmlsecurity/source/xmlsec/nss/xmlencryption_nssimpl.cxx +++ b/xmlsecurity/source/xmlsec/nss/xmlencryption_nssimpl.cxx @@ -306,11 +306,6 @@ SAL_CALL XMLEncryption_NssImpl :: decrypt( return aTemplate; } -/* XInitialization */ -void SAL_CALL XMLEncryption_NssImpl :: initialize( const Sequence< Any >& /*aArguments*/ ) throw( Exception, RuntimeException ) { - // TBD -} ; - /* XServiceInfo */ OUString SAL_CALL XMLEncryption_NssImpl :: getImplementationName() throw( RuntimeException ) { return impl_getImplementationName() ; diff --git a/xmlsecurity/source/xmlsec/nss/xmlencryption_nssimpl.hxx b/xmlsecurity/source/xmlsec/nss/xmlencryption_nssimpl.hxx index 2c56aea0f234..433a6d8a78df 100644 --- a/xmlsecurity/source/xmlsec/nss/xmlencryption_nssimpl.hxx +++ b/xmlsecurity/source/xmlsec/nss/xmlencryption_nssimpl.hxx @@ -23,21 +23,19 @@ #include <sal/config.h> #include <rtl/ustring.hxx> #include <cppuhelper/factory.hxx> -#include <cppuhelper/implbase3.hxx> +#include <cppuhelper/implbase2.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/lang/XInitialization.hpp> #include <com/sun/star/xml/crypto/XXMLEncryption.hpp> #include <com/sun/star/xml/crypto/XXMLEncryptionTemplate.hpp> #include <com/sun/star/xml/crypto/XXMLSecurityContext.hpp> -class XMLEncryption_NssImpl : public ::cppu::WeakImplHelper3< +class XMLEncryption_NssImpl : public ::cppu::WeakImplHelper2< ::com::sun::star::xml::crypto::XXMLEncryption , - ::com::sun::star::lang::XInitialization , ::com::sun::star::lang::XServiceInfo > { private : @@ -61,11 +59,6 @@ class XMLEncryption_NssImpl : public ::cppu::WeakImplHelper3< ) throw( com::sun::star::xml::crypto::XMLEncryptionException , com::sun::star::uno::SecurityException) ; - //Methods from XInitialization - virtual void SAL_CALL initialize( - const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments - ) throw( ::com::sun::star::uno::Exception , ::com::sun::star::uno::RuntimeException ) ; - //Methods from XServiceInfo virtual OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException ) ; diff --git a/xmlsecurity/source/xmlsec/nss/xmlsecuritycontext_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/xmlsecuritycontext_nssimpl.cxx index cd3c863d3e7f..3ded9ab7b82e 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::lang::XSingleServiceFactory ; 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 ) { @@ -130,11 +129,6 @@ void SAL_CALL XMLSecurityContext_NssImpl::setDefaultSecurityEnvironmentIndex( sa //i39448 : old methods deleted -/* XInitialization */ -void SAL_CALL XMLSecurityContext_NssImpl :: initialize( const Sequence< Any >& /*aArguments*/ ) throw( Exception, RuntimeException ) { - // TBD -} ; - /* XServiceInfo */ OUString SAL_CALL XMLSecurityContext_NssImpl :: getImplementationName() throw( RuntimeException ) { return impl_getImplementationName() ; @@ -169,8 +163,8 @@ OUString XMLSecurityContext_NssImpl :: impl_getImplementationName() throw( Runti } //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 9e9928aa8c9a..e48cb234f6bb 100644 --- a/xmlsecurity/source/xmlsec/nss/xmlsecuritycontext_nssimpl.hxx +++ b/xmlsecurity/source/xmlsec/nss/xmlsecuritycontext_nssimpl.hxx @@ -23,23 +23,21 @@ #include <sal/config.h> #include <rtl/ustring.hxx> #include <cppuhelper/factory.hxx> -#include <cppuhelper/implbase3.hxx> +#include <cppuhelper/implbase2.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/lang/XInitialization.hpp> #include <com/sun/star/lang/XUnoTunnel.hpp> #include <com/sun/star/xml/crypto/XSecurityEnvironment.hpp> #include <com/sun/star/xml/crypto/XXMLSecurityContext.hpp> #include <vector> -class XMLSecurityContext_NssImpl : public ::cppu::WeakImplHelper3< +class XMLSecurityContext_NssImpl : public ::cppu::WeakImplHelper2< ::com::sun::star::xml::crypto::XXMLSecurityContext , - ::com::sun::star::lang::XInitialization , ::com::sun::star::lang::XServiceInfo > { private : @@ -47,12 +45,10 @@ class XMLSecurityContext_NssImpl : public ::cppu::WeakImplHelper3< //::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 @@ -79,11 +75,6 @@ class XMLSecurityContext_NssImpl : public ::cppu::WeakImplHelper3< virtual void SAL_CALL setDefaultSecurityEnvironmentIndex( sal_Int32 nDefaultEnvIndex ) throw (::com::sun::star::uno::RuntimeException); - //Methods from XInitialization - virtual void SAL_CALL initialize( - const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments - ) throw( ::com::sun::star::uno::Exception , ::com::sun::star::uno::RuntimeException ) ; - //Methods from XServiceInfo virtual OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException ) ; diff --git a/xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx index 9d7029c7b212..11c5a8f93c69 100644 --- a/xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx +++ b/xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx @@ -271,11 +271,6 @@ SAL_CALL XMLSignature_NssImpl :: validate( return aTemplate; } -/* XInitialization */ -void SAL_CALL XMLSignature_NssImpl :: initialize( const Sequence< Any >& /*aArguments*/ ) throw( Exception, RuntimeException ) { - // TBD -} ; - /* XServiceInfo */ OUString SAL_CALL XMLSignature_NssImpl :: getImplementationName() throw( RuntimeException ) { return impl_getImplementationName() ; diff --git a/xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.hxx b/xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.hxx index b3f123c54b92..6c27b53d26ef 100644 --- a/xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.hxx +++ b/xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.hxx @@ -23,21 +23,19 @@ #include <sal/config.h> #include <rtl/ustring.hxx> #include <cppuhelper/factory.hxx> -#include <cppuhelper/implbase3.hxx> +#include <cppuhelper/implbase2.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/lang/XInitialization.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_NssImpl : public ::cppu::WeakImplHelper3< +class XMLSignature_NssImpl : public ::cppu::WeakImplHelper2< ::com::sun::star::xml::crypto::XXMLSignature , - ::com::sun::star::lang::XInitialization , ::com::sun::star::lang::XServiceInfo > { private : @@ -61,11 +59,6 @@ class XMLSignature_NssImpl : public ::cppu::WeakImplHelper3< com::sun::star::uno::SecurityException, com::sun::star::xml::crypto::XMLSignatureException); - //Methods from XInitialization - virtual void SAL_CALL initialize( - const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments - ) throw( ::com::sun::star::uno::Exception , ::com::sun::star::uno::RuntimeException ) ; - //Methods from XServiceInfo virtual OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException ) ; |