Kaydet (Commit) 84db4cc7 authored tarafından Vladimir Glazounov's avatar Vladimir Glazounov

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:
üst d3ff8f63
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: xmlsecuritycontext_nssimpl.cxx,v $ * $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 * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -92,7 +92,12 @@ using ::rtl::OUString ; ...@@ -92,7 +92,12 @@ using ::rtl::OUString ;
using ::com::sun::star::xml::crypto::XSecurityEnvironment ; using ::com::sun::star::xml::crypto::XSecurityEnvironment ;
using ::com::sun::star::xml::crypto::XXMLSecurityContext ; 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 //Init xmlsec library
if( xmlSecInit() < 0 ) { if( xmlSecInit() < 0 ) {
throw RuntimeException() ; throw RuntimeException() ;
...@@ -113,15 +118,78 @@ XMLSecurityContext_NssImpl :: XMLSecurityContext_NssImpl( const Reference< XMult ...@@ -113,15 +118,78 @@ XMLSecurityContext_NssImpl :: XMLSecurityContext_NssImpl( const Reference< XMult
} }
XMLSecurityContext_NssImpl :: ~XMLSecurityContext_NssImpl() { XMLSecurityContext_NssImpl :: ~XMLSecurityContext_NssImpl() {
#if 0 //i39448
if( m_pKeysMngr != NULL ) { if( m_pKeysMngr != NULL ) {
xmlSecKeysMngrDestroy( m_pKeysMngr ) ; xmlSecKeysMngrDestroy( m_pKeysMngr ) ;
} }
#endif
xmlDisableStreamInputCallbacks() ; xmlDisableStreamInputCallbacks() ;
xmlSecCryptoShutdown() ; xmlSecCryptoShutdown() ;
xmlSecShutdown() ; 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 */ /* XXMLSecurityContext */
void SAL_CALL XMLSecurityContext_NssImpl :: setSecurityEnvironment( const Reference< XSecurityEnvironment >& aSecurityEnvironment ) throw( com::sun::star::security::SecurityInfrastructureException ) { void SAL_CALL XMLSecurityContext_NssImpl :: setSecurityEnvironment( const Reference< XSecurityEnvironment >& aSecurityEnvironment ) throw( com::sun::star::security::SecurityInfrastructureException ) {
PK11SlotInfo* slot ; PK11SlotInfo* slot ;
...@@ -199,6 +267,8 @@ Reference< XSecurityEnvironment > SAL_CALL XMLSecurityContext_NssImpl :: getSecu ...@@ -199,6 +267,8 @@ Reference< XSecurityEnvironment > SAL_CALL XMLSecurityContext_NssImpl :: getSecu
{ {
return m_xSecurityEnvironment ; return m_xSecurityEnvironment ;
} }
#endif
/* XInitialization */ /* XInitialization */
void SAL_CALL XMLSecurityContext_NssImpl :: initialize( const Sequence< Any >& aArguments ) throw( Exception, RuntimeException ) { void SAL_CALL XMLSecurityContext_NssImpl :: initialize( const Sequence< Any >& aArguments ) throw( Exception, RuntimeException ) {
...@@ -250,6 +320,7 @@ Reference< XSingleServiceFactory > XMLSecurityContext_NssImpl :: impl_createFact ...@@ -250,6 +320,7 @@ Reference< XSingleServiceFactory > XMLSecurityContext_NssImpl :: impl_createFact
return ::cppu::createSingleFactory( aServiceManager , impl_getImplementationName() , impl_createInstance , impl_getSupportedServiceNames() ) ; return ::cppu::createSingleFactory( aServiceManager , impl_getImplementationName() , impl_createInstance , impl_getSupportedServiceNames() ) ;
} }
#if 0 //not useful any longer
/* XUnoTunnel */ /* XUnoTunnel */
sal_Int64 SAL_CALL XMLSecurityContext_NssImpl :: getSomething( const Sequence< sal_Int8 >& aIdentifier ) sal_Int64 SAL_CALL XMLSecurityContext_NssImpl :: getSomething( const Sequence< sal_Int8 >& aIdentifier )
throw (RuntimeException) throw (RuntimeException)
...@@ -288,3 +359,4 @@ xmlSecKeysMngrPtr XMLSecurityContext_NssImpl :: keysManager() throw( Exception, ...@@ -288,3 +359,4 @@ xmlSecKeysMngrPtr XMLSecurityContext_NssImpl :: keysManager() throw( Exception,
return m_pKeysMngr ; return m_pKeysMngr ;
} }
#endif
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
* *
* $RCSfile: xmlsecuritycontext_nssimpl.hxx,v $ * $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 * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
...@@ -74,8 +74,8 @@ ...@@ -74,8 +74,8 @@
#include <cppuhelper/factory.hxx> #include <cppuhelper/factory.hxx>
#endif #endif
#ifndef _CPPUHELPER_IMPLBASE4_HXX_ #ifndef _CPPUHELPER_IMPLBASE3_HXX_
#include <cppuhelper/implbase4.hxx> #include <cppuhelper/implbase3.hxx>
#endif #endif
#ifndef _COM_SUN_STAR_UNO_EXCEPTION_HPP_ #ifndef _COM_SUN_STAR_UNO_EXCEPTION_HPP_
...@@ -110,30 +110,52 @@ ...@@ -110,30 +110,52 @@
#include <com/sun/star/xml/crypto/XXMLSecurityContext.hpp> #include <com/sun/star/xml/crypto/XXMLSecurityContext.hpp>
#endif #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::xml::crypto::XXMLSecurityContext ,
::com::sun::star::lang::XInitialization , ::com::sun::star::lang::XInitialization ,
::com::sun::star::lang::XServiceInfo , ::com::sun::star::lang::XServiceInfo >
::com::sun::star::lang::XUnoTunnel >
{ {
private : private :
xmlSecKeysMngrPtr m_pKeysMngr ; //xmlSecKeysMngrPtr m_pKeysMngr ;
::com::sun::star::uno::Reference< ::com::sun::star::xml::crypto::XSecurityEnvironment > m_xSecurityEnvironment ; //::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 ; ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager ;
sal_Int32 m_nDefaultEnvIndex;
public : public :
XMLSecurityContext_NssImpl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& aFactory ) ; XMLSecurityContext_NssImpl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& aFactory ) ;
virtual ~XMLSecurityContext_NssImpl() ; virtual ~XMLSecurityContext_NssImpl() ;
//Methods from XXMLSecurityContext //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 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() virtual ::com::sun::star::uno::Reference<
throw(::com::sun::star::uno::RuntimeException); ::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 //Methods from XInitialization
virtual void SAL_CALL initialize( virtual void SAL_CALL initialize(
...@@ -159,6 +181,10 @@ class XMLSecurityContext_NssImpl : public ::cppu::WeakImplHelper4< ...@@ -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 ) ; 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 //Methods from XUnoTunnel
virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier )
throw (com::sun::star::uno::RuntimeException); throw (com::sun::star::uno::RuntimeException);
...@@ -168,6 +194,8 @@ class XMLSecurityContext_NssImpl : public ::cppu::WeakImplHelper4< ...@@ -168,6 +194,8 @@ class XMLSecurityContext_NssImpl : public ::cppu::WeakImplHelper4<
//Native mehtods //Native mehtods
virtual xmlSecKeysMngrPtr keysManager() throw( ::com::sun::star::uno::Exception , ::com::sun::star::uno::RuntimeException ) ; virtual xmlSecKeysMngrPtr keysManager() throw( ::com::sun::star::uno::Exception , ::com::sun::star::uno::RuntimeException ) ;
*/
} ; } ;
#endif // _XMLSIGNATURECONTEXT_NSSIMPL_HXX_ #endif // _XMLSIGNATURECONTEXT_NSSIMPL_HXX_
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment