diff options
author | Vladimir Glazounov <vg@openoffice.org> | 2005-03-10 17:14:20 +0000 |
---|---|---|
committer | Vladimir Glazounov <vg@openoffice.org> | 2005-03-10 17:14:20 +0000 |
commit | 84db4cc72c7e674a848b061c0a7efa5c1c71eb00 (patch) | |
tree | 3fa33ff6dd61ec7d89ee7a705097b6375ae3eebe /xmlsecurity | |
parent | d3ff8f63fc3b547d0fc11417216c35c836cdb6d0 (diff) |
INTEGRATION: CWS xmlsec08 (1.1.1.1.24); FILE MERGED
2005/01/20 03:34:29 mmi 1.1.1.1.24.1: smartcard support
Issue number: 38448
Submitted by:
Reviewed by:
Diffstat (limited to 'xmlsecurity')
-rw-r--r-- | xmlsecurity/source/xmlsec/nss/xmlsecuritycontext_nssimpl.cxx | 78 | ||||
-rw-r--r-- | xmlsecurity/source/xmlsec/nss/xmlsecuritycontext_nssimpl.hxx | 56 |
2 files changed, 117 insertions, 17 deletions
diff --git a/xmlsecurity/source/xmlsec/nss/xmlsecuritycontext_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/xmlsecuritycontext_nssimpl.cxx index 5bf5ae59a2e8..9f13fab2e3bd 100644 --- a/xmlsecurity/source/xmlsec/nss/xmlsecuritycontext_nssimpl.cxx +++ b/xmlsecurity/source/xmlsec/nss/xmlsecuritycontext_nssimpl.cxx @@ -2,9 +2,9 @@ * * $RCSfile: xmlsecuritycontext_nssimpl.cxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: mt $ $Date: 2004-07-12 13:15:21 $ + * last change: $Author: vg $ $Date: 2005-03-10 18:14:02 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -92,7 +92,12 @@ using ::rtl::OUString ; using ::com::sun::star::xml::crypto::XSecurityEnvironment ; using ::com::sun::star::xml::crypto::XXMLSecurityContext ; -XMLSecurityContext_NssImpl :: XMLSecurityContext_NssImpl( const Reference< XMultiServiceFactory >& aFactory ) : m_pKeysMngr( NULL ) , m_xServiceManager( aFactory ) , m_xSecurityEnvironment( NULL ) { +XMLSecurityContext_NssImpl :: XMLSecurityContext_NssImpl( const Reference< XMultiServiceFactory >& aFactory ) + ://i39448 : m_pKeysMngr( NULL ) , + m_nDefaultEnvIndex(-1) , + m_xServiceManager( aFactory )//, + //m_xSecurityEnvironment( NULL ) +{ //Init xmlsec library if( xmlSecInit() < 0 ) { throw RuntimeException() ; @@ -113,15 +118,78 @@ XMLSecurityContext_NssImpl :: XMLSecurityContext_NssImpl( const Reference< XMult } XMLSecurityContext_NssImpl :: ~XMLSecurityContext_NssImpl() { +#if 0 //i39448 if( m_pKeysMngr != NULL ) { xmlSecKeysMngrDestroy( m_pKeysMngr ) ; } +#endif xmlDisableStreamInputCallbacks() ; xmlSecCryptoShutdown() ; xmlSecShutdown() ; } +//i39448 : new methods +sal_Int32 SAL_CALL XMLSecurityContext_NssImpl::addSecurityEnvironment( + const ::com::sun::star::uno::Reference< ::com::sun::star::xml::crypto::XSecurityEnvironment >& aSecurityEnvironment) + throw (::com::sun::star::security::SecurityInfrastructureException, ::com::sun::star::uno::RuntimeException) +{ + if( !aSecurityEnvironment.is() ) + { + throw RuntimeException() ; + } + + m_vSecurityEnvironments.push_back( aSecurityEnvironment ); + + return m_vSecurityEnvironments.size() - 1 ; +} + + +sal_Int32 SAL_CALL XMLSecurityContext_NssImpl::getSecurityEnvironmentNumber( ) + throw (::com::sun::star::uno::RuntimeException) +{ + return m_vSecurityEnvironments.size(); +} + +::com::sun::star::uno::Reference< ::com::sun::star::xml::crypto::XSecurityEnvironment > SAL_CALL + XMLSecurityContext_NssImpl::getSecurityEnvironmentByIndex( sal_Int32 index ) + throw (::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::uno::Reference< ::com::sun::star::xml::crypto::XSecurityEnvironment > xSecurityEnvironment; + + if (index >= 0 && index < ( sal_Int32 )m_vSecurityEnvironments.size()) + { + xSecurityEnvironment = m_vSecurityEnvironments[index]; + } + else + throw RuntimeException() ; + + return xSecurityEnvironment; +} + +::com::sun::star::uno::Reference< ::com::sun::star::xml::crypto::XSecurityEnvironment > SAL_CALL + XMLSecurityContext_NssImpl::getSecurityEnvironment( ) + throw (::com::sun::star::uno::RuntimeException) +{ + if (m_nDefaultEnvIndex >= 0 && m_nDefaultEnvIndex < ( sal_Int32 )m_vSecurityEnvironments.size()) + return getSecurityEnvironmentByIndex(m_nDefaultEnvIndex); + else + throw RuntimeException() ; +} + +sal_Int32 SAL_CALL XMLSecurityContext_NssImpl::getDefaultSecurityEnvironmentIndex( ) + throw (::com::sun::star::uno::RuntimeException) +{ + return m_nDefaultEnvIndex ; +} + +void SAL_CALL XMLSecurityContext_NssImpl::setDefaultSecurityEnvironmentIndex( sal_Int32 nDefaultEnvIndex ) + throw (::com::sun::star::uno::RuntimeException) +{ + m_nDefaultEnvIndex = nDefaultEnvIndex; +} + +#if 0 //i39448 : old methods should be deleted /* XXMLSecurityContext */ void SAL_CALL XMLSecurityContext_NssImpl :: setSecurityEnvironment( const Reference< XSecurityEnvironment >& aSecurityEnvironment ) throw( com::sun::star::security::SecurityInfrastructureException ) { PK11SlotInfo* slot ; @@ -199,6 +267,8 @@ Reference< XSecurityEnvironment > SAL_CALL XMLSecurityContext_NssImpl :: getSecu { return m_xSecurityEnvironment ; } +#endif + /* XInitialization */ void SAL_CALL XMLSecurityContext_NssImpl :: initialize( const Sequence< Any >& aArguments ) throw( Exception, RuntimeException ) { @@ -250,6 +320,7 @@ Reference< XSingleServiceFactory > XMLSecurityContext_NssImpl :: impl_createFact return ::cppu::createSingleFactory( aServiceManager , impl_getImplementationName() , impl_createInstance , impl_getSupportedServiceNames() ) ; } +#if 0 //not useful any longer /* XUnoTunnel */ sal_Int64 SAL_CALL XMLSecurityContext_NssImpl :: getSomething( const Sequence< sal_Int8 >& aIdentifier ) throw (RuntimeException) @@ -288,3 +359,4 @@ xmlSecKeysMngrPtr XMLSecurityContext_NssImpl :: keysManager() throw( Exception, return m_pKeysMngr ; } +#endif diff --git a/xmlsecurity/source/xmlsec/nss/xmlsecuritycontext_nssimpl.hxx b/xmlsecurity/source/xmlsec/nss/xmlsecuritycontext_nssimpl.hxx index a5b33a720f27..65827cc31d19 100644 --- a/xmlsecurity/source/xmlsec/nss/xmlsecuritycontext_nssimpl.hxx +++ b/xmlsecurity/source/xmlsec/nss/xmlsecuritycontext_nssimpl.hxx @@ -2,9 +2,9 @@ * * $RCSfile: xmlsecuritycontext_nssimpl.hxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: mt $ $Date: 2004-07-12 13:15:21 $ + * last change: $Author: vg $ $Date: 2005-03-10 18:14:20 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -74,8 +74,8 @@ #include <cppuhelper/factory.hxx> #endif -#ifndef _CPPUHELPER_IMPLBASE4_HXX_ -#include <cppuhelper/implbase4.hxx> +#ifndef _CPPUHELPER_IMPLBASE3_HXX_ +#include <cppuhelper/implbase3.hxx> #endif #ifndef _COM_SUN_STAR_UNO_EXCEPTION_HPP_ @@ -110,30 +110,52 @@ #include <com/sun/star/xml/crypto/XXMLSecurityContext.hpp> #endif -#include "xmlsec/xmlsec.h" +#ifndef INCLUDED_VECTOR +#include <vector> +#define INCLUDED_VECTOR +#endif -class XMLSecurityContext_NssImpl : public ::cppu::WeakImplHelper4< +class XMLSecurityContext_NssImpl : public ::cppu::WeakImplHelper3< ::com::sun::star::xml::crypto::XXMLSecurityContext , ::com::sun::star::lang::XInitialization , - ::com::sun::star::lang::XServiceInfo , - ::com::sun::star::lang::XUnoTunnel > + ::com::sun::star::lang::XServiceInfo > { private : - xmlSecKeysMngrPtr m_pKeysMngr ; - ::com::sun::star::uno::Reference< ::com::sun::star::xml::crypto::XSecurityEnvironment > m_xSecurityEnvironment ; + //xmlSecKeysMngrPtr m_pKeysMngr ; + //::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 ) ; virtual ~XMLSecurityContext_NssImpl() ; //Methods from XXMLSecurityContext - virtual void SAL_CALL setSecurityEnvironment( + virtual sal_Int32 SAL_CALL addSecurityEnvironment( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::crypto::XSecurityEnvironment >& aSecurityEnvironment - ) throw( com::sun::star::security::SecurityInfrastructureException) ; + ) throw (::com::sun::star::security::SecurityInfrastructureException, ::com::sun::star::uno::RuntimeException); + + virtual ::sal_Int32 SAL_CALL getSecurityEnvironmentNumber( ) + throw (::com::sun::star::uno::RuntimeException); + + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::xml::crypto::XSecurityEnvironment > SAL_CALL + getSecurityEnvironmentByIndex( ::sal_Int32 index ) + throw (::com::sun::star::uno::RuntimeException); - virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::crypto::XSecurityEnvironment > SAL_CALL getSecurityEnvironment() - throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::xml::crypto::XSecurityEnvironment > SAL_CALL + getSecurityEnvironment( ) + throw (::com::sun::star::uno::RuntimeException); + + virtual ::sal_Int32 SAL_CALL getDefaultSecurityEnvironmentIndex( ) + throw (::com::sun::star::uno::RuntimeException); + + virtual void SAL_CALL setDefaultSecurityEnvironmentIndex( sal_Int32 nDefaultEnvIndex ) + throw (::com::sun::star::uno::RuntimeException); //Methods from XInitialization virtual void SAL_CALL initialize( @@ -159,6 +181,10 @@ class XMLSecurityContext_NssImpl : public ::cppu::WeakImplHelper4< static ::com::sun::star::uno::Reference< ::com::sun::star::lang::XSingleServiceFactory > impl_createFactory( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& aServiceManager ) ; + /* + * Because of the issue of multi-securityenvironment, so the keyManager method is not useful any longer. + * + //Methods from XUnoTunnel virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw (com::sun::star::uno::RuntimeException); @@ -168,6 +194,8 @@ class XMLSecurityContext_NssImpl : public ::cppu::WeakImplHelper4< //Native mehtods virtual xmlSecKeysMngrPtr keysManager() throw( ::com::sun::star::uno::Exception , ::com::sun::star::uno::RuntimeException ) ; + + */ } ; #endif // _XMLSIGNATURECONTEXT_NSSIMPL_HXX_ |