diff options
Diffstat (limited to 'xmlsecurity/source/framework/signatureengine.cxx')
-rw-r--r-- | xmlsecurity/source/framework/signatureengine.cxx | 136 |
1 files changed, 68 insertions, 68 deletions
diff --git a/xmlsecurity/source/framework/signatureengine.cxx b/xmlsecurity/source/framework/signatureengine.cxx index 3eea00e41434..bd5a52075099 100644 --- a/xmlsecurity/source/framework/signatureengine.cxx +++ b/xmlsecurity/source/framework/signatureengine.cxx @@ -2,7 +2,7 @@ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * + * * Copyright 2000, 2010 Oracle and/or its affiliates. * * OpenOffice.org - a multi-platform office productivity suite @@ -41,7 +41,7 @@ namespace cssxw = com::sun::star::xml::wrapper; #define SIGNATURE_TEMPLATE "com.sun.star.xml.crypto.XMLSignatureTemplate" -#define DECLARE_ASCII( SASCIIVALUE ) \ +#define DECLARE_ASCII( SASCIIVALUE ) \ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SASCIIVALUE ) ) SignatureEngine::SignatureEngine( ) @@ -53,33 +53,33 @@ bool SignatureEngine::checkReady() const /****** SignatureEngine/checkReady ******************************************* * * NAME - * checkReady -- checks the conditions for the main operation. + * checkReady -- checks the conditions for the main operation. * * SYNOPSIS - * bReady = checkReady( ); + * bReady = checkReady( ); * * FUNCTION - * checks whether all following conditions are satisfied: - * 1. the main operation has't begun yet; - * 2. the key material is known; - * 3. the amount of reference is known; - * 4. all of referenced elements, the key element and the signature - * template are bufferred. + * checks whether all following conditions are satisfied: + * 1. the main operation has't begun yet; + * 2. the key material is known; + * 3. the amount of reference is known; + * 4. all of referenced elements, the key element and the signature + * template are bufferred. * * INPUTS - * empty + * empty * * RESULT - * bReady - true if all conditions are satisfied, false otherwise + * bReady - true if all conditions are satisfied, false otherwise * * HISTORY - * 05.01.2004 - implemented + * 05.01.2004 - implemented * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ -{ +{ bool rc = true; sal_Int32 nKeyInc = 0; @@ -87,7 +87,7 @@ bool SignatureEngine::checkReady() const { nKeyInc = 1; } - + if (m_bMissionDone || m_nIdOfKeyEC == -1 || m_nTotalReferenceNumber == -1 || @@ -95,78 +95,78 @@ bool SignatureEngine::checkReady() const { rc = false; } - + return rc; } -void SignatureEngine::tryToPerform( ) +void SignatureEngine::tryToPerform( ) throw (cssu::Exception, cssu::RuntimeException) /****** SignatureEngine/tryToPerform ***************************************** * * NAME - * tryToPerform -- tries to perform the signature operation. + * tryToPerform -- tries to perform the signature operation. * * SYNOPSIS - * tryToPerform( ); + * tryToPerform( ); * * FUNCTION - * if the situation is ready, perform following operations. - * 1. prepares a signature template; - * 2. calls the signature bridge component; - * 3. clears up all used resources; - * 4. notifies the result listener; - * 5. sets the "accomplishment" flag. + * if the situation is ready, perform following operations. + * 1. prepares a signature template; + * 2. calls the signature bridge component; + * 3. clears up all used resources; + * 4. notifies the result listener; + * 5. sets the "accomplishment" flag. * * INPUTS - * empty + * empty * * RESULT - * empty + * empty * * HISTORY - * 05.01.2004 - implemented + * 05.01.2004 - implemented * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ { if (checkReady()) { const rtl::OUString ouSignatureTemplate ( - RTL_CONSTASCII_USTRINGPARAM( SIGNATURE_TEMPLATE ) ); + RTL_CONSTASCII_USTRINGPARAM( SIGNATURE_TEMPLATE ) ); cssu::Reference < cssxc::XXMLSignatureTemplate > xSignatureTemplate( mxMSF->createInstance( ouSignatureTemplate ), cssu::UNO_QUERY ); - + OSL_ASSERT( xSignatureTemplate.is() ); - + cssu::Reference< cssxw::XXMLElementWrapper > xXMLElement = m_xSAXEventKeeper->getElement( m_nIdOfTemplateEC ); - + xSignatureTemplate->setTemplate(xXMLElement); - + std::vector< sal_Int32 >::const_iterator ii = m_vReferenceIds.begin(); - - for( ; ii != m_vReferenceIds.end() ; ++ii ) + + for( ; ii != m_vReferenceIds.end() ; ++ii ) { xXMLElement = m_xSAXEventKeeper->getElement( *ii ); xSignatureTemplate->setTarget(xXMLElement); } - + /* * set the Uri binding */ xSignatureTemplate->setBinding( this ); - + startEngine( xSignatureTemplate ); - + /* * done */ clearUp( ); - + notifyResultListener(); - + m_bMissionDone = true; } } @@ -175,49 +175,49 @@ void SignatureEngine::clearUp( ) const /****** SignatureEngine/clearUp ********************************************** * * NAME - * clearUp -- clear up all resources used by this operation. + * clearUp -- clear up all resources used by this operation. * * SYNOPSIS - * clearUp( ); + * clearUp( ); * * FUNCTION - * cleaning resources up includes: - * 1. releases the ElementCollector for the signature template element; - * 2. releases ElementCollectors for referenced elements; - * 3. releases the ElementCollector for the key element, if there is one. + * cleaning resources up includes: + * 1. releases the ElementCollector for the signature template element; + * 2. releases ElementCollectors for referenced elements; + * 3. releases the ElementCollector for the key element, if there is one. * * INPUTS - * empty + * empty * * RESULT - * empty + * empty * * HISTORY - * 05.01.2004 - implemented + * 05.01.2004 - implemented * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ { cssu::Reference < cssxc::sax::XReferenceResolvedBroadcaster > xReferenceResolvedBroadcaster( m_xSAXEventKeeper, cssu::UNO_QUERY ); xReferenceResolvedBroadcaster->removeReferenceResolvedListener( - m_nIdOfTemplateEC, + m_nIdOfTemplateEC, (const cssu::Reference < cssxc::sax::XReferenceResolvedListener >)((SecurityEngine *)this)); - + m_xSAXEventKeeper->removeElementCollector(m_nIdOfTemplateEC); - + std::vector< sal_Int32 >::const_iterator ii = m_vReferenceIds.begin(); - - for( ; ii != m_vReferenceIds.end() ; ++ii ) + + for( ; ii != m_vReferenceIds.end() ; ++ii ) { xReferenceResolvedBroadcaster->removeReferenceResolvedListener( - *ii, + *ii, (const cssu::Reference < cssxc::sax::XReferenceResolvedListener >)((SecurityEngine *)this)); m_xSAXEventKeeper->removeElementCollector(*ii); } - + if (m_nIdOfKeyEC != 0 && m_nIdOfKeyEC != -1) { m_xSAXEventKeeper->removeElementCollector(m_nIdOfKeyEC); @@ -231,7 +231,7 @@ void SAL_CALL SignatureEngine::setReferenceCount( sal_Int32 count ) m_nTotalReferenceNumber = count; tryToPerform(); } - + void SAL_CALL SignatureEngine::setReferenceId( sal_Int32 id ) throw (cssu::Exception, cssu::RuntimeException) { @@ -247,14 +247,14 @@ void SAL_CALL SignatureEngine::setUriBinding( m_vUris.push_back(uri); m_vXInputStreams.push_back(aInputStream); } - + cssu::Reference< com::sun::star::io::XInputStream > SAL_CALL SignatureEngine::getUriBinding( const rtl::OUString& uri ) throw (cssu::Exception, cssu::RuntimeException) { cssu::Reference< com::sun::star::io::XInputStream > xInputStream; - + int size = m_vUris.size(); - + for( int i=0; i<size; ++i) { if (m_vUris[i] == uri) @@ -263,9 +263,9 @@ cssu::Reference< com::sun::star::io::XInputStream > SAL_CALL SignatureEngine::ge break; } } - + return xInputStream; } - + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |