From a1fb0e060c96b7a032672ebe7ab6d556274329f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=BCdiger=20Timm?= Date: Fri, 26 Nov 2004 13:55:17 +0000 Subject: [PATCH] INTEGRATION: CWS xmlsec06 (1.1.1.1.2); FILE MERGED 2004/10/12 08:30:49 mmi 1.1.1.1.2.1: add error detail information Issue number: Submitted by: Reviewed by: --- .../source/framework/signaturecreatorimpl.cxx | 16 +++++-------- .../framework/signatureverifierimpl.cxx | 18 ++++++--------- .../framework/xmlencryptiontemplateimpl.cxx | 23 ++++++++++++++++--- .../framework/xmlencryptiontemplateimpl.hxx | 12 ++++++++-- .../framework/xmlsignaturetemplateimpl.cxx | 23 ++++++++++++++++--- 5 files changed, 63 insertions(+), 29 deletions(-) diff --git a/xmlsecurity/source/framework/signaturecreatorimpl.cxx b/xmlsecurity/source/framework/signaturecreatorimpl.cxx index 3de42e6c4e11..a5f4a3e5681a 100644 --- a/xmlsecurity/source/framework/signaturecreatorimpl.cxx +++ b/xmlsecurity/source/framework/signaturecreatorimpl.cxx @@ -2,9 +2,9 @@ * * $RCSfile: signaturecreatorimpl.cxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: mt $ $Date: 2004-07-12 13:15:23 $ + * last change: $Author: rt $ $Date: 2004-11-26 14:54:21 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -160,10 +160,7 @@ void SignatureCreatorImpl::notifyResultListener() const cssu::Reference< cssxc::sax::XSignatureCreationResultListener > xSignatureCreationResultListener ( m_xResultListener , cssu::UNO_QUERY ) ; - xSignatureCreationResultListener->signatureCreated( - m_nSecurityId, - m_bOperationSucceed?(cssxc::sax::SignatureCreationResult_CREATIONSUCCEED): - (cssxc::sax::SignatureCreationResult_CREATIONFAIL)); + xSignatureCreationResultListener->signatureCreated( m_nSecurityId, m_nStatus ); } void SignatureCreatorImpl::startEngine( const cssu::Reference< @@ -202,18 +199,17 @@ void SignatureCreatorImpl::startEngine( const cssu::Reference< try { xResultTemplate = m_xXMLSignature->generate(xSignatureTemplate, m_xXMLSecurityContext); + m_nStatus = xResultTemplate->getStatus(); } catch( cssu::Exception& ) { - xResultTemplate = NULL; + m_nStatus = cssxc::SecurityOperationStatus_RUNTIMEERROR_FAILED; } - if (xResultTemplate.is()) + if (m_nStatus == cssxc::SecurityOperationStatus_OPERATION_SUCCEEDED) { cssu::Reference < cssxw::XXMLElementWrapper > xResultSignature = xResultTemplate->getTemplate(); m_xSAXEventKeeper->setElement(m_nIdOfTemplateEC, xResultSignature); - - m_bOperationSucceed = true; } } diff --git a/xmlsecurity/source/framework/signatureverifierimpl.cxx b/xmlsecurity/source/framework/signatureverifierimpl.cxx index e6e8a084ab4b..b25f6fa1b212 100644 --- a/xmlsecurity/source/framework/signatureverifierimpl.cxx +++ b/xmlsecurity/source/framework/signatureverifierimpl.cxx @@ -2,9 +2,9 @@ * * $RCSfile: signatureverifierimpl.cxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: mt $ $Date: 2004-07-12 13:15:23 $ + * last change: $Author: rt $ $Date: 2004-11-26 14:54:35 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -155,10 +155,7 @@ void SignatureVerifierImpl::notifyResultListener() const cssu::Reference< cssxc::sax::XSignatureVerifyResultListener > xSignatureVerifyResultListener ( m_xResultListener , cssu::UNO_QUERY ) ; - xSignatureVerifyResultListener->signatureVerified( - m_nSecurityId, - m_bOperationSucceed?(cssxc::sax::SignatureVerifyResult_VERIFYSUCCEED): - (cssxc::sax::SignatureVerifyResult_VERIFYFAIL)); + xSignatureVerifyResultListener->signatureVerified( m_nSecurityId, m_nStatus ); } void SignatureVerifierImpl::startEngine( const cssu::Reference< @@ -191,16 +188,15 @@ void SignatureVerifierImpl::startEngine( const cssu::Reference< * Email: michael.mi@sun.com ******************************************************************************/ { + cssu::Reference< cssxc::XXMLSignatureTemplate > xResultTemplate; try { - if ( m_xXMLSignature->validate(xSignatureTemplate, m_xXMLSecurityContext)) - { - m_bOperationSucceed = true; - } + xResultTemplate = m_xXMLSignature->validate(xSignatureTemplate, m_xXMLSecurityContext); + m_nStatus = xResultTemplate->getStatus(); } catch( cssu::Exception& ) { - m_bOperationSucceed = false; + m_nStatus = cssxc::SecurityOperationStatus_RUNTIMEERROR_FAILED; } } diff --git a/xmlsecurity/source/framework/xmlencryptiontemplateimpl.cxx b/xmlsecurity/source/framework/xmlencryptiontemplateimpl.cxx index b32f11caeeb8..72e8635137b8 100644 --- a/xmlsecurity/source/framework/xmlencryptiontemplateimpl.cxx +++ b/xmlsecurity/source/framework/xmlencryptiontemplateimpl.cxx @@ -2,9 +2,9 @@ * * $RCSfile: xmlencryptiontemplateimpl.cxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: mt $ $Date: 2004-07-12 13:15:23 $ + * last change: $Author: rt $ $Date: 2004-11-26 14:54:49 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -79,7 +79,11 @@ using ::rtl::OUString ; using ::com::sun::star::xml::wrapper::XXMLElementWrapper ; using ::com::sun::star::xml::crypto::XXMLEncryptionTemplate ; -XMLEncryptionTemplateImpl :: XMLEncryptionTemplateImpl( const Reference< XMultiServiceFactory >& aFactory ) : m_xServiceManager( aFactory ) , m_xTemplate( NULL ) , m_xTarget( NULL ) { +XMLEncryptionTemplateImpl :: XMLEncryptionTemplateImpl( const Reference< XMultiServiceFactory >& aFactory ) + : m_xServiceManager( aFactory ), + m_xTemplate( NULL ), + m_xTarget( NULL ), + m_nStatus ( ::com::sun::star::xml::crypto::SecurityOperationStatus_STATUS_UNKNOWN ) { } XMLEncryptionTemplateImpl :: ~XMLEncryptionTemplateImpl() { @@ -112,6 +116,19 @@ throw (com::sun::star::uno::RuntimeException) return m_xTarget ; } +void SAL_CALL XMLEncryptionTemplateImpl::setStatus( + ::com::sun::star::xml::crypto::SecurityOperationStatus status ) + throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) +{ + m_nStatus = status; +} + +::com::sun::star::xml::crypto::SecurityOperationStatus SAL_CALL XMLEncryptionTemplateImpl::getStatus( ) + throw (::com::sun::star::uno::RuntimeException) +{ + return m_nStatus; +} + /* XInitialization */ void SAL_CALL XMLEncryptionTemplateImpl :: initialize( const Sequence< Any >& aArguments ) throw( Exception, RuntimeException ) { // TBD diff --git a/xmlsecurity/source/framework/xmlencryptiontemplateimpl.hxx b/xmlsecurity/source/framework/xmlencryptiontemplateimpl.hxx index e020aacd8ae5..6d0078f93ce0 100644 --- a/xmlsecurity/source/framework/xmlencryptiontemplateimpl.hxx +++ b/xmlsecurity/source/framework/xmlencryptiontemplateimpl.hxx @@ -2,9 +2,9 @@ * * $RCSfile: xmlencryptiontemplateimpl.hxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: mt $ $Date: 2004-07-12 13:15:23 $ + * last change: $Author: rt $ $Date: 2004-11-26 14:55:03 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -119,6 +119,7 @@ class XMLEncryptionTemplateImpl : public ::cppu::WeakImplHelper3< ::com::sun::star::uno::Reference< ::com::sun::star::xml::wrapper::XXMLElementWrapper > m_xTemplate ; ::com::sun::star::uno::Reference< ::com::sun::star::xml::wrapper::XXMLElementWrapper > m_xTarget ; ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager ; + ::com::sun::star::xml::crypto::SecurityOperationStatus m_nStatus; public : XMLEncryptionTemplateImpl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& aFactory ) ; @@ -140,6 +141,13 @@ class XMLEncryptionTemplateImpl : public ::cppu::WeakImplHelper3< virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::wrapper::XXMLElementWrapper > SAL_CALL getTarget( ) throw (com::sun::star::uno::RuntimeException) ; + virtual void SAL_CALL setStatus( + ::com::sun::star::xml::crypto::SecurityOperationStatus status ) + throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::xml::crypto::SecurityOperationStatus + SAL_CALL getStatus( ) + 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 diff --git a/xmlsecurity/source/framework/xmlsignaturetemplateimpl.cxx b/xmlsecurity/source/framework/xmlsignaturetemplateimpl.cxx index 48a27f5db9c2..9ca5f461df58 100644 --- a/xmlsecurity/source/framework/xmlsignaturetemplateimpl.cxx +++ b/xmlsecurity/source/framework/xmlsignaturetemplateimpl.cxx @@ -2,9 +2,9 @@ * * $RCSfile: xmlsignaturetemplateimpl.cxx,v $ * - * $Revision: 1.1.1.1 $ + * $Revision: 1.2 $ * - * last change: $Author: mt $ $Date: 2004-07-12 13:15:23 $ + * last change: $Author: rt $ $Date: 2004-11-26 14:55:17 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -83,7 +83,11 @@ using ::rtl::OUString ; using ::com::sun::star::xml::wrapper::XXMLElementWrapper ; using ::com::sun::star::xml::crypto::XXMLSignatureTemplate ; -XMLSignatureTemplateImpl :: XMLSignatureTemplateImpl( const Reference< XMultiServiceFactory >& aFactory ) : m_xServiceManager( aFactory ) , m_xTemplate( NULL ) { +XMLSignatureTemplateImpl :: XMLSignatureTemplateImpl( const Reference< XMultiServiceFactory >& aFactory ) + :m_xServiceManager( aFactory ), + m_xTemplate( NULL ), + m_nStatus ( ::com::sun::star::xml::crypto::SecurityOperationStatus_STATUS_UNKNOWN ) +{ } XMLSignatureTemplateImpl :: ~XMLSignatureTemplateImpl() { @@ -141,6 +145,19 @@ void SAL_CALL XMLSignatureTemplateImpl::setBinding( return m_xUriBinding; } +void SAL_CALL XMLSignatureTemplateImpl::setStatus( + ::com::sun::star::xml::crypto::SecurityOperationStatus status ) + throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException) +{ + m_nStatus = status; +} + +::com::sun::star::xml::crypto::SecurityOperationStatus SAL_CALL XMLSignatureTemplateImpl::getStatus( ) + throw (::com::sun::star::uno::RuntimeException) +{ + return m_nStatus; +} + /* XInitialization */ void SAL_CALL XMLSignatureTemplateImpl :: initialize( const Sequence< Any >& aArguments ) throw( Exception, RuntimeException ) { // TBD