INTEGRATION: CWS xmlsec08 (1.1.1.1.24); FILE MERGED

2005/01/20 03:34:25 mmi 1.1.1.1.24.1: smartcard support
Issue number:  38448
Submitted by:
Reviewed by:
This commit is contained in:
Vladimir Glazounov 2005-03-10 17:11:41 +00:00
parent e509804080
commit b8c4e6736d
3 changed files with 103 additions and 20 deletions

View File

@ -2,9 +2,9 @@
* *
* $RCSfile: seinitializer_mscryptimpl.cxx,v $ * $RCSfile: seinitializer_mscryptimpl.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:10:32 $
* *
* 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
@ -177,7 +177,7 @@ cssu::Reference< cssxc::XXMLSecurityContext > SAL_CALL
return NULL; return NULL;
} }
xSecCtx->setSecurityEnvironment( xSecEnv ) ; xSecCtx->setDefaultSecurityEnvironmentIndex(xSecCtx->addSecurityEnvironment( xSecEnv )) ;
return xSecCtx; return xSecCtx;
} }
catch( cssu::Exception& ) catch( cssu::Exception& )

View File

@ -2,9 +2,9 @@
* *
* $RCSfile: xmlsecuritycontext_mscryptimpl.cxx,v $ * $RCSfile: xmlsecuritycontext_mscryptimpl.cxx,v $
* *
* $Revision: 1.1.1.1 $ * $Revision: 1.2 $
* *
* last change: $Author: mt $ $Date: 2004-07-12 13:15:22 $ * last change: $Author: vg $ $Date: 2005-03-10 18:11:27 $
* *
* 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
@ -93,7 +93,11 @@ 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_MSCryptImpl :: XMLSecurityContext_MSCryptImpl( const Reference< XMultiServiceFactory >& aFactory ) : m_pKeysMngr( NULL ) , m_xServiceManager( aFactory ) , m_xSecurityEnvironment( NULL ) { XMLSecurityContext_MSCryptImpl :: XMLSecurityContext_MSCryptImpl( const Reference< XMultiServiceFactory >& aFactory )
://m_pKeysMngr( NULL ) ,
m_xServiceManager( aFactory ),
m_xSecurityEnvironment( NULL )
{
//Init xmlsec library //Init xmlsec library
if( xmlSecInit() < 0 ) { if( xmlSecInit() < 0 ) {
throw RuntimeException() ; throw RuntimeException() ;
@ -114,15 +118,65 @@ XMLSecurityContext_MSCryptImpl :: XMLSecurityContext_MSCryptImpl( const Referenc
} }
XMLSecurityContext_MSCryptImpl :: ~XMLSecurityContext_MSCryptImpl() { XMLSecurityContext_MSCryptImpl :: ~XMLSecurityContext_MSCryptImpl() {
if( m_pKeysMngr != NULL ) {
xmlSecKeysMngrDestroy( m_pKeysMngr ) ;
}
xmlDisableStreamInputCallbacks() ; xmlDisableStreamInputCallbacks() ;
xmlSecCryptoShutdown() ; xmlSecCryptoShutdown() ;
xmlSecShutdown() ; xmlSecShutdown() ;
} }
//i39448 : new methods
sal_Int32 SAL_CALL XMLSecurityContext_MSCryptImpl::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_xSecurityEnvironment = aSecurityEnvironment;
return 0;
}
sal_Int32 SAL_CALL XMLSecurityContext_MSCryptImpl::getSecurityEnvironmentNumber( )
throw (::com::sun::star::uno::RuntimeException)
{
return 1;
}
::com::sun::star::uno::Reference< ::com::sun::star::xml::crypto::XSecurityEnvironment > SAL_CALL
XMLSecurityContext_MSCryptImpl::getSecurityEnvironmentByIndex( sal_Int32 index )
throw (::com::sun::star::uno::RuntimeException)
{
if (index == 0)
{
return m_xSecurityEnvironment;
}
else
throw RuntimeException() ;
}
::com::sun::star::uno::Reference< ::com::sun::star::xml::crypto::XSecurityEnvironment > SAL_CALL
XMLSecurityContext_MSCryptImpl::getSecurityEnvironment( )
throw (::com::sun::star::uno::RuntimeException)
{
return m_xSecurityEnvironment;
}
sal_Int32 SAL_CALL XMLSecurityContext_MSCryptImpl::getDefaultSecurityEnvironmentIndex( )
throw (::com::sun::star::uno::RuntimeException)
{
return 0;
}
void SAL_CALL XMLSecurityContext_MSCryptImpl::setDefaultSecurityEnvironmentIndex( sal_Int32 nDefaultEnvIndex )
throw (::com::sun::star::uno::RuntimeException)
{
//dummy
}
#if 0
/* XXMLSecurityContext */ /* XXMLSecurityContext */
void SAL_CALL XMLSecurityContext_MSCryptImpl :: setSecurityEnvironment( const Reference< XSecurityEnvironment >& aSecurityEnvironment ) throw( com::sun::star::security::SecurityInfrastructureException ) { void SAL_CALL XMLSecurityContext_MSCryptImpl :: setSecurityEnvironment( const Reference< XSecurityEnvironment >& aSecurityEnvironment ) throw( com::sun::star::security::SecurityInfrastructureException ) {
HCERTSTORE hkeyStore ; HCERTSTORE hkeyStore ;
@ -240,6 +294,7 @@ Reference< XSecurityEnvironment > SAL_CALL XMLSecurityContext_MSCryptImpl :: get
{ {
return m_xSecurityEnvironment ; return m_xSecurityEnvironment ;
} }
#endif
/* XInitialization */ /* XInitialization */
void SAL_CALL XMLSecurityContext_MSCryptImpl :: initialize( const Sequence< Any >& aArguments ) throw( Exception, RuntimeException ) { void SAL_CALL XMLSecurityContext_MSCryptImpl :: initialize( const Sequence< Any >& aArguments ) throw( Exception, RuntimeException ) {
@ -291,6 +346,7 @@ Reference< XSingleServiceFactory > XMLSecurityContext_MSCryptImpl :: impl_create
return ::cppu::createSingleFactory( aServiceManager , impl_getImplementationName() , impl_createInstance , impl_getSupportedServiceNames() ) ; return ::cppu::createSingleFactory( aServiceManager , impl_getImplementationName() , impl_createInstance , impl_getSupportedServiceNames() ) ;
} }
#if 0
/* XUnoTunnel */ /* XUnoTunnel */
sal_Int64 SAL_CALL XMLSecurityContext_MSCryptImpl :: getSomething( const Sequence< sal_Int8 >& aIdentifier ) sal_Int64 SAL_CALL XMLSecurityContext_MSCryptImpl :: getSomething( const Sequence< sal_Int8 >& aIdentifier )
throw (RuntimeException) throw (RuntimeException)
@ -328,4 +384,5 @@ XMLSecurityContext_MSCryptImpl* XMLSecurityContext_MSCryptImpl :: getImplementat
xmlSecKeysMngrPtr XMLSecurityContext_MSCryptImpl :: keysManager() throw( Exception, RuntimeException ) { xmlSecKeysMngrPtr XMLSecurityContext_MSCryptImpl :: keysManager() throw( Exception, RuntimeException ) {
return m_pKeysMngr ; return m_pKeysMngr ;
} }
#endif

View File

@ -2,9 +2,9 @@
* *
* $RCSfile: xmlsecuritycontext_mscryptimpl.hxx,v $ * $RCSfile: xmlsecuritycontext_mscryptimpl.hxx,v $
* *
* $Revision: 1.1.1.1 $ * $Revision: 1.2 $
* *
* last change: $Author: mt $ $Date: 2004-07-12 13:15:22 $ * last change: $Author: vg $ $Date: 2005-03-10 18:11:41 $
* *
* 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 @@
#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,16 +110,15 @@
#include <com/sun/star/xml/crypto/XXMLSecurityContext.hpp> #include <com/sun/star/xml/crypto/XXMLSecurityContext.hpp>
#endif #endif
#include "xmlsec/xmlsec.h" //#include "xmlsec/xmlsec.h"
class XMLSecurityContext_MSCryptImpl : public ::cppu::WeakImplHelper4< class XMLSecurityContext_MSCryptImpl : 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 ;
::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager ; ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager ;
@ -128,12 +127,37 @@ class XMLSecurityContext_MSCryptImpl : public ::cppu::WeakImplHelper4<
virtual ~XMLSecurityContext_MSCryptImpl() ; virtual ~XMLSecurityContext_MSCryptImpl() ;
//Methods from XXMLSecurityContext //Methods from XXMLSecurityContext
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, ::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 ::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);
#if 0
virtual void SAL_CALL setSecurityEnvironment( virtual void SAL_CALL setSecurityEnvironment(
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) ;
virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::crypto::XSecurityEnvironment > SAL_CALL getSecurityEnvironment() virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::crypto::XSecurityEnvironment > SAL_CALL getSecurityEnvironment()
throw(::com::sun::star::uno::RuntimeException); throw(::com::sun::star::uno::RuntimeException);
#endif
//Methods from XInitialization //Methods from XInitialization
virtual void SAL_CALL initialize( virtual void SAL_CALL initialize(
@ -159,15 +183,17 @@ class XMLSecurityContext_MSCryptImpl : 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 ) ;
#if 0
//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);
static const ::com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelId() ; static const ::com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelId() ;
static XMLSecurityContext_MSCryptImpl* getImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xObj ) ; static XMLSecurityContext_MSCryptImpl* getImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xObj ) ;
#endif
//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_MSCRYPTIMPL_HXX_ #endif // _XMLSIGNATURECONTEXT_MSCRYPTIMPL_HXX_