diff options
Diffstat (limited to 'xmlsecurity/source/helper/xsecctl.cxx')
-rw-r--r-- | xmlsecurity/source/helper/xsecctl.cxx | 538 |
1 files changed, 269 insertions, 269 deletions
diff --git a/xmlsecurity/source/helper/xsecctl.cxx b/xmlsecurity/source/helper/xsecctl.cxx index d2af8a56c760..864d6de8df14 100644 --- a/xmlsecurity/source/helper/xsecctl.cxx +++ b/xmlsecurity/source/helper/xsecctl.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 @@ -179,7 +179,7 @@ sal_Bool XSecController::convertDateTime( com::sun::star::util::DateTime& rDateT aTimeStr = rString.copy( nPos + 1, nPos2 - nPos - 1 ); //Get the fraction of a second with the accuracy of one hundreds second. - //The fraction part of the date could have different accuracies. To calculate + //The fraction part of the date could have different accuracies. To calculate //the count of a hundredth units one could form a fractional number by appending //the value of the time string to 0. Then multiply it by 100 and use only the whole number. //For example: 5:27:46,1 -> 0,1 * 100 = 10 @@ -276,38 +276,38 @@ sal_Bool XSecController::convertDateTime( com::sun::star::util::DateTime& rDateT } return bSuccess; } - + int XSecController::findSignatureInfor( sal_Int32 nSecurityId) const /****** XSecController/findSignatureInfor ************************************* * * NAME - * findSignatureInfor -- find SignatureInformation struct for a particular - * signature + * findSignatureInfor -- find SignatureInformation struct for a particular + * signature * * SYNOPSIS - * index = findSignatureInfor( nSecurityId ); + * index = findSignatureInfor( nSecurityId ); * * FUNCTION - * see NAME. + * see NAME. * * INPUTS - * nSecurityId - the signature's id + * nSecurityId - the signature's id * * RESULT - * index - the index of the signature, or -1 when no such signature - * existing + * index - the index of the signature, or -1 when no such signature + * existing * * HISTORY - * 08.05.2004 - implemented + * 08.05.2004 - implemented * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ { int i; int size = m_vInternalSignatureInformations.size(); - + for (i=0; i<size; ++i) { if (m_vInternalSignatureInformations[i].signatureInfor.nSecurityId == nSecurityId) @@ -315,7 +315,7 @@ int XSecController::findSignatureInfor( sal_Int32 nSecurityId) const return i; } } - + return -1; } @@ -323,35 +323,35 @@ void XSecController::createXSecComponent( ) /****** XSecController/createXSecComponent ************************************ * * NAME - * bResult = createXSecComponent -- creates xml security components + * bResult = createXSecComponent -- creates xml security components * * SYNOPSIS - * createXSecComponent( ); + * createXSecComponent( ); * * FUNCTION - * Creates xml security components, including: - * 1. an xml signature bridge component ( Java based or C based) - * 2. an XMLDocumentWrapper component ( Java based or C based) - * 3. a SAXEventKeeper component + * Creates xml security components, including: + * 1. an xml signature bridge component ( Java based or C based) + * 2. an XMLDocumentWrapper component ( Java based or C based) + * 3. a SAXEventKeeper component * * 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 ******************************************************************************/ { rtl::OUString sSAXEventKeeper(rtl::OUString::createFromAscii( SAXEVENTKEEPER_COMPONENT )); rtl::OUString sXMLSignature(rtl::OUString::createFromAscii( XMLSIGNATURE_COMPONENT )); rtl::OUString sXMLDocument(rtl::OUString::createFromAscii( XMLDOCUMENTWRAPPER_COMPONENT )); - + /* * marks all security components are not available. */ @@ -361,11 +361,11 @@ void XSecController::createXSecComponent( ) m_xSAXEventKeeper = NULL; cssu::Reference< cssl::XMultiComponentFactory > xMCF( mxCtx->getServiceManager() ); - + m_xXMLSignature = cssu::Reference< cssxc::XXMLSignature >( xMCF->createInstanceWithContext( sXMLSignature, mxCtx ), cssu::UNO_QUERY ); - + bool bSuccess = (0!=m_xXMLSignature.is()); if ( bSuccess ) /* @@ -376,7 +376,7 @@ void XSecController::createXSecComponent( ) xMCF->createInstanceWithContext( sXMLDocument, mxCtx ), cssu::UNO_QUERY ); } - + bSuccess &= (0!=m_xXMLDocumentWrapper.is()); if ( bSuccess ) /* @@ -389,26 +389,26 @@ void XSecController::createXSecComponent( ) } bSuccess &= (0!=m_xSAXEventKeeper.is()); - + if (bSuccess) /* * SAXEventKeeper created successfully. */ { cssu::Reference< cssl::XInitialization > xInitialization(m_xSAXEventKeeper, cssu::UNO_QUERY); - + cssu::Sequence <cssu::Any> arg(1); arg[0] = cssu::makeAny(m_xXMLDocumentWrapper); xInitialization->initialize(arg); - - cssu::Reference<cssxc::sax::XSAXEventKeeperStatusChangeBroadcaster> - xSAXEventKeeperStatusChangeBroadcaster(m_xSAXEventKeeper, cssu::UNO_QUERY); + + cssu::Reference<cssxc::sax::XSAXEventKeeperStatusChangeBroadcaster> + xSAXEventKeeperStatusChangeBroadcaster(m_xSAXEventKeeper, cssu::UNO_QUERY); cssu::Reference< cssxc::sax::XSAXEventKeeperStatusChangeListener > xStatusChangeListener = this; - + xSAXEventKeeperStatusChangeBroadcaster ->addSAXEventKeeperStatusChangeListener( xStatusChangeListener ); - + m_nStatusOfSecurityComponents = INITIALIZED; } } @@ -417,55 +417,55 @@ bool XSecController::chainOn( bool bRetrievingLastEvent ) /****** XSecController/chainOn ************************************************ * * NAME - * chainOn -- tyies to connect the SAXEventKeeper with the SAX chain. + * chainOn -- tyies to connect the SAXEventKeeper with the SAX chain. * * SYNOPSIS - * bJustChainingOn = chainOn( bRetrievingLastEvent ); + * bJustChainingOn = chainOn( bRetrievingLastEvent ); * * FUNCTION - * First, checks whether the SAXEventKeeper is on the SAX chain. If not, - * creates xml security components, and chains the SAXEventKeeper into - * the SAX chain. - * Before being chained in, the SAXEventKeeper needs to receive all - * missed key SAX events, which can promise the DOM tree bufferred by the - * SAXEventKeeper has the same structure with the original document. + * First, checks whether the SAXEventKeeper is on the SAX chain. If not, + * creates xml security components, and chains the SAXEventKeeper into + * the SAX chain. + * Before being chained in, the SAXEventKeeper needs to receive all + * missed key SAX events, which can promise the DOM tree bufferred by the + * SAXEventKeeper has the same structure with the original document. * * INPUTS - * bRetrievingLastEvent - whether to retrieve the last key SAX event from - * the ElementStackKeeper. - * + * bRetrievingLastEvent - whether to retrieve the last key SAX event from + * the ElementStackKeeper. + * * RESULT - * bJustChainingOn - whether the SAXEventKeeper is just chained into the - * SAX chain. + * bJustChainingOn - whether the SAXEventKeeper is just chained into the + * SAX chain. * * NOTES - * Sometimes, the last key SAX event can't be transferred to the - * SAXEventKeeper together. - * For instance, at the time an referenced element is detected, the - * startElement event has already been reserved by the ElementStackKeeper. - * Meanwhile, an ElementCollector needs to be created before the - * SAXEventKeeper receives that startElement event. - * So for the SAXEventKeeper, it needs to receive all missed key SAX - * events except that startElement event, then adds a new - * ElementCollector, then receives that startElement event. + * Sometimes, the last key SAX event can't be transferred to the + * SAXEventKeeper together. + * For instance, at the time an referenced element is detected, the + * startElement event has already been reserved by the ElementStackKeeper. + * Meanwhile, an ElementCollector needs to be created before the + * SAXEventKeeper receives that startElement event. + * So for the SAXEventKeeper, it needs to receive all missed key SAX + * events except that startElement event, then adds a new + * ElementCollector, then receives that startElement event. * * 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 = false; - + if (!m_bIsSAXEventKeeperSticky && !m_bIsSAXEventKeeperConnected) { if ( m_nStatusOfSecurityComponents == UNINITIALIZED ) { createXSecComponent(); } - + if ( m_nStatusOfSecurityComponents == INITIALIZED ) /* * if all security components are ready, chains on the SAXEventKeeper @@ -477,9 +477,9 @@ bool XSecController::chainOn( bool bRetrievingLastEvent ) * phase. */ m_xSAXEventKeeper->setNextHandler( NULL ); - + cssu::Reference< cssxs::XDocumentHandler > xSEKHandler(m_xSAXEventKeeper, cssu::UNO_QUERY); - + /* * connects the previous document handler on the SAX chain */ @@ -489,7 +489,7 @@ bool XSecController::chainOn( bool bRetrievingLastEvent ) { cssu::Reference< cssl::XInitialization > xInitialization (m_xPreviousNodeOnSAXChain, cssu::UNO_QUERY); - + cssu::Sequence<cssu::Any> aArgs( 1 ); aArgs[0] <<= xSEKHandler; xInitialization->initialize(aArgs); @@ -501,33 +501,33 @@ bool XSecController::chainOn( bool bRetrievingLastEvent ) xParser->setDocumentHandler( xSEKHandler ); } } - + /* * get missed key SAX events */ if (m_xElementStackKeeper.is()) { m_xElementStackKeeper->retrieve(xSEKHandler, bRetrievingLastEvent); - + /* - * now the ElementStackKeeper can stop its work, because the + * now the ElementStackKeeper can stop its work, because the * SAXEventKeeper is on the SAX chain, no SAX events will be * missed. */ m_xElementStackKeeper->stop(); } - + /* * connects the next document handler on the SAX chain */ m_xSAXEventKeeper->setNextHandler( m_xNextNodeOnSAXChain ); - + m_bIsSAXEventKeeperConnected = true; - + rc = true; } } - + return rc; } @@ -535,26 +535,26 @@ void XSecController::chainOff() /****** XSecController/chainOff *********************************************** * * NAME - * chainOff -- disconnects the SAXEventKeeper from the SAX chain. + * chainOff -- disconnects the SAXEventKeeper from the SAX chain. * * SYNOPSIS - * chainOff( ); + * chainOff( ); * * FUNCTION - * See NAME. + * See NAME. * * 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 (!m_bIsSAXEventKeeperSticky ) @@ -562,14 +562,14 @@ void XSecController::chainOff() if (m_bIsSAXEventKeeperConnected) { m_xSAXEventKeeper->setNextHandler( NULL ); - + if ( m_xPreviousNodeOnSAXChain.is() ) { if ( m_bIsPreviousNodeInitializable ) { cssu::Reference< cssl::XInitialization > xInitialization (m_xPreviousNodeOnSAXChain, cssu::UNO_QUERY); - + cssu::Sequence<cssu::Any> aArgs( 1 ); aArgs[0] <<= m_xNextNodeOnSAXChain; xInitialization->initialize(aArgs); @@ -580,7 +580,7 @@ void XSecController::chainOff() xParser->setDocumentHandler( m_xNextNodeOnSAXChain ); } } - + if (m_xElementStackKeeper.is()) { /* @@ -589,7 +589,7 @@ void XSecController::chainOff() */ m_xElementStackKeeper->start(); } - + m_bIsSAXEventKeeperConnected = false; } } @@ -599,30 +599,30 @@ void XSecController::checkChainingStatus() /****** XSecController/checkChainingStatus ************************************ * * NAME - * checkChainingStatus -- connects or disconnects the SAXEventKeeper - * according to the current situation. + * checkChainingStatus -- connects or disconnects the SAXEventKeeper + * according to the current situation. * * SYNOPSIS - * checkChainingStatus( ); + * checkChainingStatus( ); * * FUNCTION - * The SAXEventKeeper is chained into the SAX chain, when: - * 1. some element is being collected, or - * 2. the SAX event stream is blocking. - * Otherwise, chain off the SAXEventKeeper. + * The SAXEventKeeper is chained into the SAX chain, when: + * 1. some element is being collected, or + * 2. the SAX event stream is blocking. + * Otherwise, chain off the SAXEventKeeper. * * 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 ( m_bIsCollectingElement || m_bIsBlocking ) @@ -639,35 +639,35 @@ void XSecController::initializeSAXChain() /****** XSecController/initializeSAXChain ************************************* * * NAME - * initializeSAXChain -- initializes the SAX chain according to the - * current setting. + * initializeSAXChain -- initializes the SAX chain according to the + * current setting. * * SYNOPSIS - * initializeSAXChain( ); + * initializeSAXChain( ); * * FUNCTION - * Initializes the SAX chain, if the SAXEventKeeper is asked to be always - * on the SAX chain, chains it on. Otherwise, starts the - * ElementStackKeeper to reserve key SAX events. + * Initializes the SAX chain, if the SAXEventKeeper is asked to be always + * on the SAX chain, chains it on. Otherwise, starts the + * ElementStackKeeper to reserve key SAX events. * * 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 ******************************************************************************/ { m_bIsSAXEventKeeperConnected = false; m_bIsCollectingElement = false; m_bIsBlocking = false; - + if (m_xElementStackKeeper.is()) { /* @@ -675,80 +675,80 @@ void XSecController::initializeSAXChain() */ m_xElementStackKeeper->start(); } - + chainOff(); } -cssu::Reference< com::sun::star::io::XInputStream > +cssu::Reference< com::sun::star::io::XInputStream > XSecController::getObjectInputStream( const rtl::OUString& objectURL ) /****** XSecController/getObjectInputStream ************************************ * * NAME - * getObjectInputStream -- get a XInputStream interface from a SvStorage + * getObjectInputStream -- get a XInputStream interface from a SvStorage * * SYNOPSIS - * xInputStream = getObjectInputStream( objectURL ); + * xInputStream = getObjectInputStream( objectURL ); * * FUNCTION - * See NAME. + * See NAME. * * INPUTS - * objectURL - the object uri + * objectURL - the object uri * * RESULT - * xInputStream - the XInputStream interface + * xInputStream - the XInputStream interface * * HISTORY - * 15.04.2004 - implemented + * 15.04.2004 - implemented * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ { cssu::Reference< com::sun::star::io::XInputStream > xObjectInputStream; DBG_ASSERT( m_xUriBinding.is(), "Need XUriBinding!" ); - + xObjectInputStream = m_xUriBinding->getUriBinding(objectURL); - + return xObjectInputStream; -} +} #if 0 sal_Int32 XSecController::getFastPropertyIndex(sal_Int32 nHandle) const /****** XSecController/getFastPropertyIndex *********************************** * * NAME - * getFastPropertyIndex -- gets the index of a particular fast property + * getFastPropertyIndex -- gets the index of a particular fast property * * SYNOPSIS - * nIndex = getFastPropertyIndex( nHandle ); + * nIndex = getFastPropertyIndex( nHandle ); * * FUNCTION - * See NAME. + * See NAME. * * INPUTS - * nHandle - the key for the fast property + * nHandle - the key for the fast property * * RESULT - * nIndex - the index of the fast property, or -1 - * if the key is not found. + * nIndex - the index of the fast property, or -1 + * if the key is not found. * * HISTORY - * 05.01.2004 - implemented + * 05.01.2004 - implemented * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ { std::vector< sal_Int32 >::const_iterator ii = m_vFastPropertyIndexs.begin(); sal_Int32 nIndex = 0; - + bool bFound = false; - - for( ; ii != m_vFastPropertyIndexs.end(); ++ii,++nIndex ) + + for( ; ii != m_vFastPropertyIndexs.end(); ++ii,++nIndex ) { if ( nHandle == (*ii)) { @@ -756,18 +756,18 @@ sal_Int32 XSecController::getFastPropertyIndex(sal_Int32 nHandle) const break; } } - + if (!bFound) { nIndex = -1; } - + return nIndex; } #endif /* - * public methods + * public methods */ sal_Int32 XSecController::getNewSecurityId( ) @@ -783,39 +783,39 @@ void XSecController::startMission( /****** XSecController/startMission ******************************************* * * NAME - * startMission -- starts a new security mission. + * startMission -- starts a new security mission. * * SYNOPSIS - * startMission( xUriBinding, xSecurityContect ); + * startMission( xUriBinding, xSecurityContect ); * * FUNCTION - * get ready for a new mission. + * get ready for a new mission. * * INPUTS - * xUriBinding - the Uri binding that provide maps between uris and + * xUriBinding - the Uri binding that provide maps between uris and * XInputStreams - * xSecurityContext - the security context component which can provide - * cryptoken + * xSecurityContext - the security context component which can provide + * cryptoken * * 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 ******************************************************************************/ { m_xUriBinding = xUriBinding; - + m_nStatusOfSecurityComponents = UNINITIALIZED; m_xSecurityContext = xSecurityContext; m_pErrorMessage = NULL; m_vInternalSignatureInformations.clear(); - + m_bVerifyCurrentSignature = false; } @@ -826,32 +826,32 @@ void XSecController::setSAXChainConnector( /****** XSecController/setSAXChainConnector *********************************** * * NAME - * setSAXChainConnector -- configures the components which will - * collaborate with the SAXEventKeeper on the SAX chain. + * setSAXChainConnector -- configures the components which will + * collaborate with the SAXEventKeeper on the SAX chain. * * SYNOPSIS - * setSAXChainConnector( xInitialization, - * xDocumentHandler, - * xElementStackKeeper ); + * setSAXChainConnector( xInitialization, + * xDocumentHandler, + * xElementStackKeeper ); * * FUNCTION - * See NAME. + * See NAME. * * INPUTS - * xInitialization - the previous node on the SAX chain - * xDocumentHandler - the next node on the SAX chain - * xElementStackKeeper - the ElementStackKeeper component which reserves - * missed key SAX events for the SAXEventKeeper + * xInitialization - the previous node on the SAX chain + * xDocumentHandler - the next node on the SAX chain + * xElementStackKeeper - the ElementStackKeeper component which reserves + * missed key SAX events for the SAXEventKeeper * * 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 ******************************************************************************/ { m_bIsPreviousNodeInitializable = true; @@ -869,37 +869,37 @@ void XSecController::setSAXChainConnector( /****** XSecController/setSAXChainConnector *********************************** * * NAME - * setSAXChainConnector -- configures the components which will - * collaborate with the SAXEventKeeper on the SAX chain. + * setSAXChainConnector -- configures the components which will + * collaborate with the SAXEventKeeper on the SAX chain. * * SYNOPSIS - * setSAXChainConnector( xParser, xDocumentHandler, xElementStackKeeper ); + * setSAXChainConnector( xParser, xDocumentHandler, xElementStackKeeper ); * * FUNCTION - * See NAME. + * See NAME. * * INPUTS - * xParser - the previous node on the SAX chain - * xDocumentHandler - the next node on the SAX chain - * xElementStackKeeper -the ElementStackKeeper component which reserves - * missed key SAX events for the SAXEventKeeper + * xParser - the previous node on the SAX chain + * xDocumentHandler - the next node on the SAX chain + * xElementStackKeeper -the ElementStackKeeper component which reserves + * missed key SAX events for the SAXEventKeeper * * 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 ******************************************************************************/ { m_bIsPreviousNodeInitializable = false; m_xPreviousNodeOnSAXChain = xParser; m_xNextNodeOnSAXChain = xDocumentHandler; m_xElementStackKeeper = xElementStackKeeper; - + initializeSAXChain( ); } @@ -907,26 +907,26 @@ void XSecController::clearSAXChainConnector() /****** XSecController/clearSAXChainConnector ********************************* * * NAME - * clearSAXChainConnector -- resets the collaborating components. + * clearSAXChainConnector -- resets the collaborating components. * * SYNOPSIS - * clearSAXChainConnector( ); + * clearSAXChainConnector( ); * * FUNCTION - * See NAME. + * See NAME. * * 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 ******************************************************************************/ { /* @@ -940,7 +940,7 @@ void XSecController::clearSAXChainConnector() cssu::Reference< cssxs::XDocumentHandler > xSEKHandler(m_xSAXEventKeeper, cssu::UNO_QUERY); m_xElementStackKeeper->retrieve(xSEKHandler, sal_True); } - + chainOff(); m_xPreviousNodeOnSAXChain = NULL; @@ -952,30 +952,30 @@ void XSecController::endMission() /****** XSecController/endMission ********************************************* * * NAME - * endMission -- forces to end all missions + * endMission -- forces to end all missions * * SYNOPSIS - * endMission( ); + * endMission( ); * * FUNCTION - * Deletes all signature information and forces all missions to an end. + * Deletes all signature information and forces all missions to an end. * * 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 ******************************************************************************/ { sal_Int32 size = m_vInternalSignatureInformations.size(); - + for (int i=0; i<size; ++i) { if ( m_nStatusOfSecurityComponents == INITIALIZED ) @@ -985,25 +985,25 @@ void XSecController::endMission() { cssu::Reference< cssxc::sax::XMissionTaker > xMissionTaker ( m_vInternalSignatureInformations[i].xReferenceResolvedListener, cssu::UNO_QUERY ); - + /* * askes the SignatureCreator/SignatureVerifier to release * all resouces it uses. - */ + */ xMissionTaker->endMission(); } } - + m_xUriBinding = NULL; m_xSecurityContext = NULL; - + /* * free the status change listener reference to this object */ if (m_xSAXEventKeeper.is()) { - cssu::Reference<cssxc::sax::XSAXEventKeeperStatusChangeBroadcaster> - xSAXEventKeeperStatusChangeBroadcaster(m_xSAXEventKeeper, cssu::UNO_QUERY); + cssu::Reference<cssxc::sax::XSAXEventKeeperStatusChangeBroadcaster> + xSAXEventKeeperStatusChangeBroadcaster(m_xSAXEventKeeper, cssu::UNO_QUERY); xSAXEventKeeperStatusChangeBroadcaster ->addSAXEventKeeperStatusChangeListener( NULL ); } @@ -1013,26 +1013,26 @@ const char* XSecController::getErrorMessage() /****** XSecController/getErrorMessage **************************************** * * NAME - * getErrorMessage -- get the last error message + * getErrorMessage -- get the last error message * * SYNOPSIS - * pErrorMessage = getErrorMessage( ); + * pErrorMessage = getErrorMessage( ); * * FUNCTION - * see NAME. + * see NAME. * * INPUTS - * empty + * empty * * RESULT - * empty + * empty * * HISTORY - * 22.04.2004 - implemented + * 22.04.2004 - implemented * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ { return m_pErrorMessage; @@ -1044,27 +1044,27 @@ void XSecController::exportSignature( /****** XSecController/exportSignature **************************************** * * NAME - * exportSignature -- export a signature structure to an XDocumentHandler + * exportSignature -- export a signature structure to an XDocumentHandler * * SYNOPSIS - * exportSignature( xDocumentHandler, signatureInfo); + * exportSignature( xDocumentHandler, signatureInfo); * * FUNCTION - * see NAME. + * see NAME. * * INPUTS - * xDocumentHandler - the document handler to receive the signature - * signatureInfo - signature to be exported + * xDocumentHandler - the document handler to receive the signature + * signatureInfo - signature to be exported * * RESULT - * empty + * empty * * HISTORY - * 26.05.2004 - implemented + * 26.05.2004 - implemented * * AUTHOR - * Michael Mi - * Email: michael.mi@sun.com + * Michael Mi + * Email: michael.mi@sun.com ******************************************************************************/ { /* @@ -1091,34 +1091,34 @@ void XSecController::exportSignature( rtl::OUString tag_SignatureProperties(RTL_CONSTASCII_USTRINGPARAM(TAG_SIGNATUREPROPERTIES)); rtl::OUString tag_SignatureProperty(RTL_CONSTASCII_USTRINGPARAM(TAG_SIGNATUREPROPERTY)); rtl::OUString tag_Date(RTL_CONSTASCII_USTRINGPARAM(TAG_DATE)); -#if 0 +#if 0 rtl::OUString tag_Timestamp(RTL_CONSTASCII_USTRINGPARAM(TAG_TIMESTAMP)); rtl::OUString tag_Date(RTL_CONSTASCII_USTRINGPARAM(TAG_DATE)); rtl::OUString tag_Time(RTL_CONSTASCII_USTRINGPARAM(TAG_TIME)); #endif - + const SignatureReferenceInformations& vReferenceInfors = signatureInfo.vSignatureReferenceInfors; SvXMLAttributeList *pAttributeList; /* - * Write Signature element + * Write Signature element */ pAttributeList = new SvXMLAttributeList(); pAttributeList->AddAttribute( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(ATTR_XMLNS)), rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(NS_XMLDSIG))); - + if (signatureInfo.ouSignatureId.getLength()>0) { pAttributeList->AddAttribute( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(ATTR_ID)), rtl::OUString(signatureInfo.ouSignatureId)); } - + xDocumentHandler->startElement( tag_Signature, cssu::Reference< cssxs::XAttributeList > (pAttributeList)); { /* Write SignedInfo element */ - xDocumentHandler->startElement( + xDocumentHandler->startElement( tag_SignedInfo, cssu::Reference< cssxs::XAttributeList > (new SvXMLAttributeList())); { @@ -1129,7 +1129,7 @@ void XSecController::exportSignature( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(ALGO_C14N))); xDocumentHandler->startElement( tag_CanonicalizationMethod, cssu::Reference< cssxs::XAttributeList > (pAttributeList) ); xDocumentHandler->endElement( tag_CanonicalizationMethod ); - + /* Write SignatureMethod element */ pAttributeList = new SvXMLAttributeList(); pAttributeList->AddAttribute( @@ -1141,7 +1141,7 @@ void XSecController::exportSignature( /* Write Reference element */ int j; int refNum = vReferenceInfors.size(); - + for(j=0; j<refNum; ++j) { const SignatureReferenceInformation& refInfor = vReferenceInfors[j]; @@ -1165,7 +1165,7 @@ void XSecController::exportSignature( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(ATTR_URI)), rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(CHAR_FRAGMENT))+refInfor.ouURI); } - + xDocumentHandler->startElement( tag_Reference, cssu::Reference< cssxs::XAttributeList > (pAttributeList) ); { /* Write Transforms element */ @@ -1182,24 +1182,24 @@ void XSecController::exportSignature( pAttributeList->AddAttribute( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(ATTR_ALGORITHM)), rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(ALGO_C14N))); - xDocumentHandler->startElement( + xDocumentHandler->startElement( tag_Transform, cssu::Reference< cssxs::XAttributeList > (pAttributeList) ); xDocumentHandler->endElement( tag_Transform ); } xDocumentHandler->endElement( tag_Transforms ); } - + /* Write DigestMethod element */ pAttributeList = new SvXMLAttributeList(); pAttributeList->AddAttribute( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(ATTR_ALGORITHM)), rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(ALGO_XMLDSIGSHA1))); - xDocumentHandler->startElement( + xDocumentHandler->startElement( tag_DigestMethod, cssu::Reference< cssxs::XAttributeList > (pAttributeList) ); xDocumentHandler->endElement( tag_DigestMethod ); - + /* Write DigestValue element */ xDocumentHandler->startElement( tag_DigestValue, @@ -1211,49 +1211,49 @@ void XSecController::exportSignature( } } xDocumentHandler->endElement( tag_SignedInfo ); - + /* Write SignatureValue element */ - xDocumentHandler->startElement( + xDocumentHandler->startElement( tag_SignatureValue, cssu::Reference< cssxs::XAttributeList > (new SvXMLAttributeList())); xDocumentHandler->characters( signatureInfo.ouSignatureValue ); xDocumentHandler->endElement( tag_SignatureValue ); - + /* Write KeyInfo element */ - xDocumentHandler->startElement( + xDocumentHandler->startElement( tag_KeyInfo, cssu::Reference< cssxs::XAttributeList > (new SvXMLAttributeList())); { /* Write X509Data element */ - xDocumentHandler->startElement( + xDocumentHandler->startElement( tag_X509Data, cssu::Reference< cssxs::XAttributeList > (new SvXMLAttributeList())); { /* Write X509IssuerSerial element */ - xDocumentHandler->startElement( + xDocumentHandler->startElement( tag_X509IssuerSerial, cssu::Reference< cssxs::XAttributeList > (new SvXMLAttributeList())); { /* Write X509IssuerName element */ - xDocumentHandler->startElement( + xDocumentHandler->startElement( tag_X509IssuerName, cssu::Reference< cssxs::XAttributeList > (new SvXMLAttributeList())); xDocumentHandler->characters( signatureInfo.ouX509IssuerName ); xDocumentHandler->endElement( tag_X509IssuerName ); - + /* Write X509SerialNumber element */ - xDocumentHandler->startElement( + xDocumentHandler->startElement( tag_X509SerialNumber, cssu::Reference< cssxs::XAttributeList > (new SvXMLAttributeList())); xDocumentHandler->characters( signatureInfo.ouX509SerialNumber ); xDocumentHandler->endElement( tag_X509SerialNumber ); } xDocumentHandler->endElement( tag_X509IssuerSerial ); - + /* Write X509Certificate element */ if (signatureInfo.ouX509Certificate.getLength()>0) { - xDocumentHandler->startElement( + xDocumentHandler->startElement( tag_X509Certificate, cssu::Reference< cssxs::XAttributeList > (new SvXMLAttributeList())); xDocumentHandler->characters( signatureInfo.ouX509Certificate ); @@ -1263,14 +1263,14 @@ void XSecController::exportSignature( xDocumentHandler->endElement( tag_X509Data ); } xDocumentHandler->endElement( tag_KeyInfo ); - + /* Write Object element */ - xDocumentHandler->startElement( + xDocumentHandler->startElement( tag_Object, cssu::Reference< cssxs::XAttributeList > (new SvXMLAttributeList())); { /* Write SignatureProperties element */ - xDocumentHandler->startElement( + xDocumentHandler->startElement( tag_SignatureProperties, cssu::Reference< cssxs::XAttributeList > (new SvXMLAttributeList())); { @@ -1282,12 +1282,12 @@ void XSecController::exportSignature( pAttributeList->AddAttribute( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(ATTR_TARGET)), rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(CHAR_FRAGMENT))+signatureInfo.ouSignatureId); - xDocumentHandler->startElement( + xDocumentHandler->startElement( tag_SignatureProperty, cssu::Reference< cssxs::XAttributeList > (pAttributeList)); { /* Write timestamp element */ - + pAttributeList = new SvXMLAttributeList(); pAttributeList->AddAttribute( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(ATTR_XMLNS)) @@ -1295,16 +1295,16 @@ void XSecController::exportSignature( +rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(NSTAG_DC)), rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(NS_DC))); - xDocumentHandler->startElement( + xDocumentHandler->startElement( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(NSTAG_DC)) +rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(":")) +tag_Date, cssu::Reference< cssxs::XAttributeList > (pAttributeList)); - + ::rtl::OUStringBuffer buffer; - //If the xml signature was already contained in the document, - //then we use the original date and time string, rather then the - //converted one. When the original string is converted to the DateTime + //If the xml signature was already contained in the document, + //then we use the original date and time string, rather then the + //converted one. When the original string is converted to the DateTime //structure then information may be lost because it only holds a fractional //of a second with a accuracy of one hundredth of second. If the string contains //milli seconds (document was signed by an application other than OOo) @@ -1316,7 +1316,7 @@ void XSecController::exportSignature( convertDateTime( buffer, signatureInfo.stDateTime ); xDocumentHandler->characters( buffer.makeStringAndClear() ); - xDocumentHandler->endElement( + xDocumentHandler->endElement( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(NSTAG_DC)) +rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(":")) +tag_Date); @@ -1326,7 +1326,7 @@ void XSecController::exportSignature( xDocumentHandler->endElement( tag_SignatureProperties ); } xDocumentHandler->endElement( tag_Object ); - } + } xDocumentHandler->endElement( tag_Signature ); } @@ -1346,13 +1346,13 @@ SignatureInformations XSecController::getSignatureInformations() const { SignatureInformations vInfors; int sigNum = m_vInternalSignatureInformations.size(); - + for (int i=0; i<sigNum; ++i) { SignatureInformation si = m_vInternalSignatureInformations[i].signatureInfor; vInfors.push_back(si); } - + return vInfors; } @@ -1363,13 +1363,13 @@ SignatureInformations XSecController::getSignatureInformations() const */ /* - * XFastPropertySet + * XFastPropertySet */ /* void SAL_CALL XSecController::setFastPropertyValue( sal_Int32 nHandle, const cssu::Any& aValue ) - throw ( cssb::UnknownPropertyException, + throw ( cssb::UnknownPropertyException, cssb::PropertyVetoException, cssl::IllegalArgumentException, cssl::WrappedTargetException, @@ -1386,7 +1386,7 @@ void SAL_CALL XSecController::setFastPropertyValue( m_vFastPropertyValues[nIndex] = aValue; } } - + cssu::Any SAL_CALL XSecController::getFastPropertyValue( sal_Int32 nHandle ) throw ( @@ -1401,7 +1401,7 @@ cssu::Any SAL_CALL XSecController::getFastPropertyValue( { aValue = m_vFastPropertyValues[nIndex]; } - + return aValue; } */ @@ -1409,7 +1409,7 @@ cssu::Any SAL_CALL XSecController::getFastPropertyValue( /* * XSAXEventKeeperStatusChangeListener */ - + void SAL_CALL XSecController::blockingStatusChanged( sal_Bool isBlocking ) throw (cssu::RuntimeException) { @@ -1423,18 +1423,18 @@ void SAL_CALL XSecController::blockingStatusChanged( sal_Bool isBlocking ) this->m_bIsBlocking = isBlocking; checkChainingStatus(); } - -void SAL_CALL XSecController::collectionStatusChanged( + +void SAL_CALL XSecController::collectionStatusChanged( sal_Bool isInsideCollectedElement ) throw (cssu::RuntimeException) { /* - showMessageBox( rtl::OUString::createFromAscii((isInsideCollectedElement? + showMessageBox( rtl::OUString::createFromAscii((isInsideCollectedElement? "Collection Status => TRUE": "Collection Status => FALSE")), rtl::OUString::createFromAscii("SAXEventKeeper Status")); */ - + this->m_bIsCollectingElement = isInsideCollectedElement; checkChainingStatus(); } @@ -1443,7 +1443,7 @@ void SAL_CALL XSecController::bufferStatusChanged( sal_Bool /*isBufferEmpty*/) throw (cssu::RuntimeException) { /* - showMessageBox( rtl::OUString::createFromAscii((isBufferEmpty? + showMessageBox( rtl::OUString::createFromAscii((isBufferEmpty? "Buffer Empty => TRUE": "Buffer Empty => FALSE")), rtl::OUString::createFromAscii("SAXEventKeeper Status")); @@ -1460,7 +1460,7 @@ void SAL_CALL XSecController::signatureCreated( sal_Int32 securityId, com::sun:: DBG_ASSERT( index != -1, "Signature Not Found!" ); SignatureInformation& signatureInfor = m_vInternalSignatureInformations[index].signatureInfor; - + /* if (nResult == cssxc::sax::SignatureCreationResult_CREATIONSUCCEED) { @@ -1469,7 +1469,7 @@ void SAL_CALL XSecController::signatureCreated( sal_Int32 securityId, com::sun:: else { signatureInfor.nStatus = STATUS_CREATION_FAIL; - } + } */ signatureInfor.nStatus = nResult; } @@ -1484,7 +1484,7 @@ void SAL_CALL XSecController::signatureVerified( sal_Int32 securityId, com::sun: DBG_ASSERT( index != -1, "Signature Not Found!" ); SignatureInformation& signatureInfor = m_vInternalSignatureInformations[index].signatureInfor; - + /* if (nResult == cssxc::sax::SignatureVerifyResult_VERIFYSUCCEED) { |