summaryrefslogtreecommitdiff
path: root/xmlsecurity/source/framework
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2012-01-28 20:52:45 +0100
committerMichael Stahl <mstahl@redhat.com>2012-01-28 20:52:45 +0100
commit2e626373db2412ac22e8c5c27a60d11cd29e875b (patch)
tree9e9f67205cd5b72f1031721273e1534a3a1e5b0f /xmlsecurity/source/framework
parentf7ee7bbd5174b084f018c2ec94d8c70c98ee04da (diff)
replace obsolete "master" branch with README that points at new repoHEADmaster-deletedmaster
Diffstat (limited to 'xmlsecurity/source/framework')
-rw-r--r--xmlsecurity/source/framework/buffernode.cxx1198
-rw-r--r--xmlsecurity/source/framework/buffernode.hxx136
-rw-r--r--xmlsecurity/source/framework/decryptorimpl.cxx238
-rw-r--r--xmlsecurity/source/framework/decryptorimpl.hxx134
-rw-r--r--xmlsecurity/source/framework/elementcollector.cxx273
-rw-r--r--xmlsecurity/source/framework/elementcollector.hxx106
-rw-r--r--xmlsecurity/source/framework/elementmark.cxx104
-rw-r--r--xmlsecurity/source/framework/elementmark.hxx84
-rw-r--r--xmlsecurity/source/framework/encryptionengine.cxx209
-rw-r--r--xmlsecurity/source/framework/encryptionengine.hxx102
-rw-r--r--xmlsecurity/source/framework/encryptorimpl.cxx274
-rw-r--r--xmlsecurity/source/framework/encryptorimpl.hxx147
-rw-r--r--xmlsecurity/source/framework/makefile.mk61
-rw-r--r--xmlsecurity/source/framework/saxeventkeeperimpl.cxx1426
-rw-r--r--xmlsecurity/source/framework/saxeventkeeperimpl.hxx365
-rw-r--r--xmlsecurity/source/framework/securityengine.cxx90
-rw-r--r--xmlsecurity/source/framework/securityengine.hxx169
-rw-r--r--xmlsecurity/source/framework/signaturecreatorimpl.cxx287
-rw-r--r--xmlsecurity/source/framework/signaturecreatorimpl.hxx145
-rw-r--r--xmlsecurity/source/framework/signatureengine.cxx262
-rw-r--r--xmlsecurity/source/framework/signatureengine.hxx141
-rw-r--r--xmlsecurity/source/framework/signatureverifierimpl.cxx235
-rw-r--r--xmlsecurity/source/framework/signatureverifierimpl.hxx133
-rw-r--r--xmlsecurity/source/framework/xmlencryptiontemplateimpl.cxx141
-rw-r--r--xmlsecurity/source/framework/xmlencryptiontemplateimpl.hxx112
-rw-r--r--xmlsecurity/source/framework/xmlsignaturetemplateimpl.cxx166
-rw-r--r--xmlsecurity/source/framework/xmlsignaturetemplateimpl.hxx122
-rw-r--r--xmlsecurity/source/framework/xsec_framework.cxx168
28 files changed, 0 insertions, 7028 deletions
diff --git a/xmlsecurity/source/framework/buffernode.cxx b/xmlsecurity/source/framework/buffernode.cxx
deleted file mode 100644
index 2ba40f25c..000000000
--- a/xmlsecurity/source/framework/buffernode.cxx
+++ /dev/null
@@ -1,1198 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * 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
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_xmlsecurity.hxx"
-
-#include "elementmark.hxx"
-#include "elementcollector.hxx"
-#include "buffernode.hxx"
-#include <com/sun/star/xml/crypto/sax/ConstOfSecurityId.hpp>
-
-namespace cssu = com::sun::star::uno;
-namespace cssxw = com::sun::star::xml::wrapper;
-namespace cssxc = com::sun::star::xml::crypto;
-
-BufferNode::BufferNode( const cssu::Reference< cssxw::XXMLElementWrapper >& xXMLElement )
- :m_pParent(NULL),
- m_pBlocker(NULL),
- m_bAllReceived(false),
- m_xXMLElement(xXMLElement)
-{
-}
-
-bool BufferNode::isECOfBeforeModifyIncluded(sal_Int32 nIgnoredSecurityId) const
-/****** BufferNode/isECOfBeforeModifyIncluded ********************************
- *
- * NAME
- * isECOfBeforeModifyIncluded -- checks whether there is some
- * ElementCollector on this BufferNode, that has BEFORE-MODIFY priority.
- *
- * SYNOPSIS
- * bExist = isECOfBeforeModifyIncluded(nIgnoredSecurityId);
- *
- * FUNCTION
- * checks each ElementCollector on this BufferNode, if all following
- * conditions are satisfied, then returns true:
- * 1. the ElementCollector's priority is BEFOREMODIFY;
- * 2. the ElementCollector's securityId can't be ignored.
- * otherwise, returns false.
- *
- * INPUTS
- * nIgnoredSecurityId - the security Id to be ignored. If it equals
- * to UNDEFINEDSECURITYID, then no security Id
- * will be ignored.
- *
- * RESULT
- * bExist - true if a match found, false otherwise
- *
- * AUTHOR
- * Michael Mi
- * Email: michael.mi@sun.com
- ******************************************************************************/
-{
- bool rc = false;
- std::vector< const ElementCollector* >::const_iterator ii = m_vElementCollectors.begin();
-
- for( ; ii != m_vElementCollectors.end() ; ++ii )
- {
- ElementCollector* pElementCollector = (ElementCollector*)*ii;
-
- if ((nIgnoredSecurityId == cssxc::sax::ConstOfSecurityId::UNDEFINEDSECURITYID ||
- pElementCollector->getSecurityId() != nIgnoredSecurityId) &&
- (pElementCollector->getPriority() == cssxc::sax::ElementMarkPriority_BEFOREMODIFY))
- {
- rc = true;
- break;
- }
- }
-
- return rc;
-}
-
-void BufferNode::setReceivedAll()
-/****** BufferNode/setReceiveAll *********************************************
- *
- * NAME
- * setReceivedAll -- indicates that the element in this BufferNode has
- * been compeletely bufferred.
- *
- * SYNOPSIS
- * setReceivedAll();
- *
- * FUNCTION
- * sets the all-received flag and launches ElementCollector's notify
- * process.
- *
- * INPUTS
- * empty
- *
- * RESULT
- * empty
- *
- * AUTHOR
- * Michael Mi
- * Email: michael.mi@sun.com
- ******************************************************************************/
-{
- m_bAllReceived = true;
- elementCollectorNotify();
-}
-
-bool BufferNode::isAllReceived() const
-{
- return m_bAllReceived;
-}
-
-void BufferNode::addElementCollector(const ElementCollector* pElementCollector)
-/****** BufferNode/addElementCollector ***************************************
- *
- * NAME
- * addElementCollector -- adds a new ElementCollector to this BufferNode.
- *
- * SYNOPSIS
- * addElementCollector(pElementCollector);
- *
- * FUNCTION
- * see NAME
- *
- * INPUTS
- * pElementCollector - the ElementCollector to be added
- *
- * RESULT
- * empty
- *
- * AUTHOR
- * Michael Mi
- * Email: michael.mi@sun.com
- ******************************************************************************/
-{
- m_vElementCollectors.push_back( pElementCollector );
- ((ElementCollector*)pElementCollector)->setBufferNode(this);
-}
-
-void BufferNode::removeElementCollector(const ElementCollector* pElementCollector)
-/****** BufferNode/removeElementCollector ************************************
- *
- * NAME
- * removeElementCollector -- removes an ElementCollector from this
- * BufferNode.
- *
- * SYNOPSIS
- * removeElementCollector(pElementCollector);
- *
- * FUNCTION
- * see NAME
- *
- * INPUTS
- * pElementCollector - the ElementCollector to be removed
- *
- * RESULT
- * empty
- *
- * AUTHOR
- * Michael Mi
- * Email: michael.mi@sun.com
- ******************************************************************************/
-{
- std::vector< const ElementCollector* >::iterator ii = m_vElementCollectors.begin();
-
- for( ; ii != m_vElementCollectors.end() ; ++ii )
- {
- if( *ii == pElementCollector )
- {
- m_vElementCollectors.erase( ii );
- ((ElementCollector*)pElementCollector)->setBufferNode(NULL);
- break;
- }
- }
-}
-
-ElementMark* BufferNode::getBlocker() const
-{
- return m_pBlocker;
-}
-
-void BufferNode::setBlocker(const ElementMark* pBlocker)
-/****** BufferNode/setBlocker ************************************************
- *
- * NAME
- * setBlocker -- adds a blocker to this BufferNode.
- *
- * SYNOPSIS
- * setBlocker(pBlocker);
- *
- * FUNCTION
- * see NAME
- *
- * INPUTS
- * pBlocker - the new blocker to be attached
- *
- * RESULT
- * empty
- *
- * NOTES
- * Because there is only one blocker permited for a BufferNode, so the
- * old blocker on this BufferNode, if there is one, will be overcasted.
- *
- * AUTHOR
- * Michael Mi
- * Email: michael.mi@sun.com
- ******************************************************************************/
-{
- OSL_ASSERT(!(m_pBlocker != NULL && pBlocker != NULL));
-
- m_pBlocker = (ElementMark*)pBlocker;
- if (m_pBlocker != NULL)
- {
- m_pBlocker->setBufferNode(this);
- }
-}
-
-rtl::OUString BufferNode::printChildren() const
-/****** BufferNode/printChildren *********************************************
- *
- * NAME
- * printChildren -- prints children information into a string.
- *
- * SYNOPSIS
- * result = printChildren();
- *
- * FUNCTION
- * see NAME
- *
- * INPUTS
- * empty
- *
- * RESULT
- * result - the information string
- *
- * AUTHOR
- * Michael Mi
- * Email: michael.mi@sun.com
- ******************************************************************************/
-{
- rtl::OUString rc;
- std::vector< const ElementCollector* >::const_iterator ii = m_vElementCollectors.begin();
-
- for( ; ii != m_vElementCollectors.end() ; ++ii )
- {
- rc += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "BufID=" ));
- rc += rtl::OUString::valueOf((*ii)->getBufferId());
-
- if (((ElementCollector*)(*ii))->getModify())
- {
- rc += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "[M]" ));
- }
-
- rc += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ",Pri=" ));
-
- switch (((ElementCollector*)(*ii))->getPriority())
- {
- case cssxc::sax::ElementMarkPriority_BEFOREMODIFY:
- rc += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "BEFOREMODIFY" ));
- break;
- case cssxc::sax::ElementMarkPriority_AFTERMODIFY:
- rc += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "AFTERMODIFY" ));
- break;
- default:
- rc += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "UNKNOWN" ));
- break;
- }
-
- rc += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "(" ));
- rc += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "SecID=" ));
- rc += rtl::OUString::valueOf(((ElementCollector*)(*ii))->getSecurityId());
- rc += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ")" ));
- rc += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( " " ));
- }
-
- return rc;
-}
-
-bool BufferNode::hasAnything() const
-/****** BufferNode/hasAnything ***********************************************
- *
- * NAME
- * hasAnything -- checks whether there is any ElementCollector or blocker
- * on this BufferNode.
- *
- * SYNOPSIS
- * bExist = hasAnything();
- *
- * FUNCTION
- * see NAME
- *
- * INPUTS
- * empty
- *
- * RESULT
- * bExist - true if there is, false otherwise.
- *
- * AUTHOR
- * Michael Mi
- * Email: michael.mi@sun.com
- ******************************************************************************/
-{
- return (m_pBlocker != NULL || !m_vElementCollectors.empty());
-}
-
-bool BufferNode::hasChildren() const
-/****** BufferNode/hasChildren ***********************************************
- *
- * NAME
- * hasChildren -- checks whether this BufferNode has any child
- * BufferNode.
- *
- * SYNOPSIS
- * bExist = hasChildren();
- *
- * FUNCTION
- * see NAME
- *
- * INPUTS
- * empty
- *
- * RESULT
- * bExist - true if there is, false otherwise.
- *
- * AUTHOR
- * Michael Mi
- * Email: michael.mi@sun.com
- ******************************************************************************/
-{
- return (!m_vChildren.empty());
-}
-
-std::vector< const BufferNode* >* BufferNode::getChildren() const
-{
- return new std::vector< const BufferNode* >( m_vChildren );
-}
-
-const BufferNode* BufferNode::getFirstChild() const
-/****** BufferNode/getFirstChild *********************************************
- *
- * NAME
- * getFirstChild -- retrieves the first child BufferNode.
- *
- * SYNOPSIS
- * child = getFirstChild();
- *
- * FUNCTION
- * see NAME
- *
- * INPUTS
- * empty
- *
- * RESULT
- * child - the first child BufferNode, or NULL if there is no child
- * BufferNode.
- *
- * AUTHOR
- * Michael Mi
- * Email: michael.mi@sun.com
- ******************************************************************************/
-{
- BufferNode* rc = NULL;
-
- if (!m_vChildren.empty())
- {
- rc = (BufferNode*)m_vChildren.front();
- }
-
- return (const BufferNode*)rc;
-}
-
-void BufferNode::addChild(const BufferNode* pChild, sal_Int32 nPosition)
-/****** BufferNode/addChild(pChild,nPosition) ********************************
- *
- * NAME
- * addChild -- inserts a child BufferNode at specific position.
- *
- * SYNOPSIS
- * addChild(pChild, nPosition);
- *
- * FUNCTION
- * see NAME
- *
- * INPUTS
- * pChild - the child BufferNode to be added.
- * nPosition - the position where the new child locates.
- *
- * RESULT
- * empty
- *
- * NOTES
- * If the nPosition is -1, then the new child BufferNode is appended
- * at the end.
- *
- * AUTHOR
- * Michael Mi
- * Email: michael.mi@sun.com
- ******************************************************************************/
-{
- if (nPosition == -1)
- {
- m_vChildren.push_back( pChild );
- }
- else
- {
- std::vector< const BufferNode* >::iterator ii = m_vChildren.begin();
- ii += nPosition;
- m_vChildren.insert(ii, pChild);
- }
-}
-
-void BufferNode::addChild(const BufferNode* pChild)
-/****** BufferNode/addChild() ************************************************
- *
- * NAME
- * addChild -- add a new child BufferNode.
- *
- * SYNOPSIS
- * addChild(pChild);
- *
- * FUNCTION
- * see NAME
- *
- * INPUTS
- * pChild - the child BufferNode to be added.
- *
- * RESULT
- * empty
- *
- * NOTES
- * The new child BufferNode is appended at the end.
- *
- * AUTHOR
- * Michael Mi
- * Email: michael.mi@sun.com
- ******************************************************************************/
-{
- addChild(pChild, -1);
-}
-
-void BufferNode::removeChild(const BufferNode* pChild)
-/****** BufferNode/removeChild ***********************************************
- *
- * NAME
- * removeChild -- removes a child BufferNode from the children list.
- *
- * SYNOPSIS
- * removeChild(pChild);
- *
- * FUNCTION
- * see NAME
- *
- * INPUTS
- * pChild - the child BufferNode to be removed
- *
- * RESULT
- * empty
- *
- * AUTHOR
- * Michael Mi
- * Email: michael.mi@sun.com
- ******************************************************************************/
-{
- std::vector< const BufferNode* >::iterator ii = m_vChildren.begin();
-
- for( ; ii != m_vChildren.end() ; ++ii )
- {
- if( *ii == pChild )
- {
- m_vChildren.erase( ii );
- break;
- }
- }
-}
-
-sal_Int32 BufferNode::indexOfChild(const BufferNode* pChild) const
-/****** BufferNode/indexOfChild **********************************************
- *
- * NAME
- * indexOfChild -- gets the index of a child BufferNode.
- *
- * SYNOPSIS
- * index = indexOfChild(pChild);
- *
- * FUNCTION
- * see NAME
- *
- * INPUTS
- * pChild - the child BufferNode whose index to be gotten
- *
- * RESULT
- * index - the index of that child BufferNode. If that child BufferNode
- * is not found, -1 is returned.
- *
- * AUTHOR
- * Michael Mi
- * Email: michael.mi@sun.com
- ******************************************************************************/
-{
- sal_Int32 nIndex = 0;
- bool bFound = false;
-
- std::vector< const BufferNode * >::const_iterator ii = m_vChildren.begin();
-
- for( ; ii != m_vChildren.end() ; ++ii )
- {
- if( *ii == pChild )
- {
- bFound = true;
- break;
- }
- nIndex++;
- }
-
- if (!bFound )
- {
- nIndex = -1;
- }
-
- return nIndex;
-}
-
-const BufferNode* BufferNode::childAt(sal_Int32 nIndex) const
-/****** BufferNode/childAt ***************************************************
- *
- * NAME
- * childAt -- retrieves the child BufferNode at specific possition.
- *
- * SYNOPSIS
- * child = childAt(nIndex);
- *
- * FUNCTION
- * see NAME
- *
- * INPUTS
- * nIndex - the index of the child BufferNode to be retrieved
- *
- * RESULT
- * child - the child BufferNode at index position, or NULL if the index
- * is out of the range of children.
- *
- * AUTHOR
- * Michael Mi
- * Email: michael.mi@sun.com
- ******************************************************************************/
-{
- BufferNode* rc = NULL;
-
- if (nIndex < ((sal_Int32)m_vChildren.size()) && nIndex >= 0)
- {
- rc = (BufferNode*)m_vChildren[nIndex];
- }
-
- return (const BufferNode*)rc;
-}
-
-const BufferNode* BufferNode::getParent() const
-{
- return m_pParent;
-}
-
-void BufferNode::setParent(const BufferNode* pParent)
-{
- m_pParent = (BufferNode*)pParent;
-}
-
-const BufferNode* BufferNode::getNextSibling() const
-/****** BufferNode/getNextSibling ********************************************
- *
- * NAME
- * getNextSibling -- retrieves the next sibling BufferNode.
- *
- * SYNOPSIS
- * sibling = getNextSibling();
- *
- * FUNCTION
- * see NAME
- *
- * INPUTS
- * empty
- *
- * RESULT
- * sibling - the next sibling BufferNode, or NULL if there is none.
- *
- * AUTHOR
- * Michael Mi
- * Email: michael.mi@sun.com
- ******************************************************************************/
-{
- BufferNode* rc = NULL;
-
- if (m_pParent != NULL)
- {
- rc = (BufferNode*)m_pParent->getNextChild(this);
- }
-
- return (const BufferNode*)rc;
-}
-
-const BufferNode* BufferNode::isAncestor(const BufferNode* pDescendant) const
-/****** BufferNode/isAncestor ************************************************
- *
- * NAME
- * isAncestor -- checks whether this BufferNode is an ancestor of another
- * BufferNode.
- *
- * SYNOPSIS
- * bIs = isAncestor(pDescendant);
- *
- * FUNCTION
- * see NAME
- *
- * INPUTS
- * pDescendant - the BufferNode to be checked as a descendant
- *
- * RESULT
- * bIs - true if this BufferNode is an ancestor of the pDescendant,
- * false otherwise.
- *
- * AUTHOR
- * Michael Mi
- * Email: michael.mi@sun.com
- ******************************************************************************/
-{
- BufferNode* rc = NULL;
-
- if (pDescendant != NULL)
- {
- std::vector< const BufferNode* >::const_iterator ii = m_vChildren.begin();
-
- for( ; ii != m_vChildren.end() ; ++ii )
- {
- BufferNode* pChild = (BufferNode*)*ii;
-
- if (pChild == pDescendant)
- {
- rc = pChild;
- break;
- }
-
- if (pChild->isAncestor(pDescendant) != NULL)
- {
- rc = pChild;
- break;
- }
- }
- }
-
- return (const BufferNode*)rc;
-}
-
-bool BufferNode::isPrevious(const BufferNode* pFollowing) const
-/****** BufferNode/isPrevious ************************************************
- *
- * NAME
- * isPrevious -- checks whether this BufferNode is ahead of another
- * BufferNode in the tree order.
- *
- * SYNOPSIS
- * bIs = isPrevious(pFollowing);
- *
- * FUNCTION
- * see NAME
- *
- * INPUTS
- * pFollowing - the BufferNode to be checked as a following
- *
- * RESULT
- * bIs - true if this BufferNode is ahead in the tree order, false
- * otherwise.
- *
- * AUTHOR
- * Michael Mi
- * Email: michael.mi@sun.com
- ******************************************************************************/
-{
- bool rc = false;
-
- BufferNode* pNextBufferNode = (BufferNode*)getNextNodeByTreeOrder();
- while (pNextBufferNode != NULL)
- {
- if (pNextBufferNode == pFollowing)
- {
- rc = true;
- break;
- }
-
- pNextBufferNode = (BufferNode*)(pNextBufferNode->getNextNodeByTreeOrder());
- }
-
- return rc;
-}
-
-const BufferNode* BufferNode::getNextNodeByTreeOrder() const
-/****** BufferNode/getNextNodeByTreeOrder ************************************
- *
- * NAME
- * getNextNodeByTreeOrder -- retrieves the next BufferNode in the tree
- * order.
- *
- * SYNOPSIS
- * next = getNextNodeByTreeOrder();
- *
- * FUNCTION
- * see NAME
- *
- * INPUTS
- * empty
- *
- * RESULT
- * next - the BufferNode following this BufferNode in the tree order,
- * or NULL if there is none.
- *
- * NOTES
- * The "next" node in tree order is defined as:
- * 1. If a node has children, then the first child is;
- * 2. otherwise, if it has a following sibling, then this sibling node is;
- * 3. otherwise, if it has a parent node, the the parent's next sibling
- * node is;
- * 4. otherwise, no "next" node exists.
- *
- * AUTHOR
- * Michael Mi
- * Email: michael.mi@sun.com
- ******************************************************************************/
-{
- /*
- * If this buffer node has m_vChildren, then return the first
- * child.
- */
- if (hasChildren())
- {
- return getFirstChild();
- }
-
- /*
- * Otherwise, it this buffer node has a following sibling,
- * then return that sibling.
- */
- BufferNode* pNextSibling = (BufferNode*)getNextSibling();
- if (pNextSibling != NULL)
- {
- return pNextSibling;
- }
-
- /*
- * Otherwise, it this buffer node has parent, then return
- * its parent's following sibling.
- */
- BufferNode* pNode = (BufferNode*)this;
- BufferNode* pParent;
- BufferNode* pNextSiblingParent = NULL;
-
- do
- {
- if (pNode == NULL)
- {
- break;
- }
-
- pParent = (BufferNode*)pNode->getParent();
- if (pParent != NULL)
- {
- pNextSiblingParent = (BufferNode*)pParent->getNextSibling();
- }
- pNode = pParent;
-
- }while (pNextSiblingParent == NULL);
-
- return pNextSiblingParent;
-}
-
-cssu::Reference< cssxw::XXMLElementWrapper > BufferNode::getXMLElement() const
-{
- return m_xXMLElement;
-}
-
-void BufferNode::setXMLElement( const cssu::Reference< cssxw::XXMLElementWrapper >& xXMLElement )
-{
- m_xXMLElement = xXMLElement;
-}
-
-void BufferNode::notifyBranch()
-/****** BufferNode/notifyBranch **********************************************
- *
- * NAME
- * notifyBranch -- notifies each BufferNode in the branch of this
- * BufferNode in the tree order.
- *
- * SYNOPSIS
- * notifyBranch();
- *
- * FUNCTION
- * see NAME
- *
- * INPUTS
- * empty
- *
- * RESULT
- * empty
- *
- * AUTHOR
- * Michael Mi
- * Email: michael.mi@sun.com
- ******************************************************************************/
-{
- std::vector< const BufferNode* >::const_iterator ii = m_vChildren.begin();
-
- for( ; ii != m_vChildren.end() ; ++ii )
- {
- BufferNode* pBufferNode = (BufferNode*)*ii;
- pBufferNode->elementCollectorNotify();
- pBufferNode->notifyBranch();
- }
-}
-
-void BufferNode::notifyAncestor()
-/****** BufferNode/notifyAncestor ********************************************
- *
- * NAME
- * notifyAncestor -- notifies each ancestor BufferNode through the parent
- * link.
- *
- * SYNOPSIS
- * notifyAncestor();
- *
- * FUNCTION
- * see NAME
- *
- * INPUTS
- * empty
- *
- * RESULT
- * empty
- *
- * AUTHOR
- * Michael Mi
- * Email: michael.mi@sun.com
- ******************************************************************************/
-{
- BufferNode* pParent = m_pParent;
- while (pParent != NULL)
- {
- pParent->notifyAncestor();
- pParent = (BufferNode*)pParent->getParent();
- }
-}
-
-void BufferNode::elementCollectorNotify()
-/****** BufferNode/elementCollectorNotify ************************************
- *
- * NAME
- * elementCollectorNotify -- notifies this BufferNode.
- *
- * SYNOPSIS
- * elementCollectorNotify();
- *
- * FUNCTION
- * Notifies this BufferNode if the notification is not suppressed.
- *
- * INPUTS
- * empty
- *
- * RESULT
- * child - the first child BufferNode, or NULL if there is no child
- * BufferNode.
- *
- * AUTHOR
- * Michael Mi
- * Email: michael.mi@sun.com
- ******************************************************************************/
-{
- if (!m_vElementCollectors.empty())
- {
- cssxc::sax::ElementMarkPriority nMaxPriority = cssxc::sax::ElementMarkPriority_MINIMUM;
- cssxc::sax::ElementMarkPriority nPriority;
-
- /*
- * get the max priority among ElementCollectors on this BufferNode
- */
- std::vector< const ElementCollector* >::const_iterator ii = m_vElementCollectors.begin();
- for( ; ii != m_vElementCollectors.end() ; ++ii )
- {
- ElementCollector* pElementCollector = (ElementCollector*)*ii;
- nPriority = pElementCollector->getPriority();
- if (nPriority > nMaxPriority)
- {
- nMaxPriority = nPriority;
- }
- }
-
- std::vector< const ElementCollector* > vElementCollectors( m_vElementCollectors );
- ii = vElementCollectors.begin();
-
- for( ; ii != vElementCollectors.end() ; ++ii )
- {
- ElementCollector* pElementCollector = (ElementCollector*)*ii;
- nPriority = pElementCollector->getPriority();
- bool bToModify = pElementCollector->getModify();
-
- /*
- * Only ElementCollector with the max priority can
- * perform notify operation.
- * Moreover, if any blocker exists in the subtree of
- * this BufferNode, this ElementCollector can't do notify
- * unless its priority is BEFOREMODIFY.
- */
- if (nPriority == nMaxPriority &&
- (nPriority == cssxc::sax::ElementMarkPriority_BEFOREMODIFY ||
- !isBlockerInSubTreeIncluded(pElementCollector->getSecurityId())))
- {
- /*
- * If this ElementCollector will modify the bufferred element, then
- * special attention must be paid.
- *
- * If there is any ElementCollector in the subtree or any ancestor
- * ElementCollector with PRI_BEFPREMODIFY priority, this
- * ElementCollector can't perform notify operation, otherwise, it
- * will destroy the bufferred element, in turn, ElementCollectors
- * mentioned above can't perform their mission.
- */
- //if (!(nMaxPriority == cssxc::sax::ElementMarkPriority_PRI_MODIFY &&
- if (!(bToModify &&
- (isECInSubTreeIncluded(pElementCollector->getSecurityId()) ||
- isECOfBeforeModifyInAncestorIncluded(pElementCollector->getSecurityId()))
- ))
- {
- pElementCollector->notifyListener();
- }
- }
- }
- }
-}
-
-bool BufferNode::isECInSubTreeIncluded(sal_Int32 nIgnoredSecurityId) const
-/****** BufferNode/isECInSubTreeIncluded *************************************
- *
- * NAME
- * isECInSubTreeIncluded -- checks whether there is any ElementCollector
- * in the branch of this BufferNode.
- *
- * SYNOPSIS
- * bExist = isECInSubTreeIncluded(nIgnoredSecurityId);
- *
- * FUNCTION
- * checks each BufferNode in the branch of this BufferNode, if there is
- * an ElementCollector whose signatureId is not ignored, then return
- * true, otherwise, false returned.
- *
- * INPUTS
- * nIgnoredSecurityId - the security Id to be ignored. If it equals
- * to UNDEFINEDSECURITYID, then no security Id
- * will be ignored.
- *
- * RESULT
- * bExist - true if a match found, false otherwise.
- *
- * AUTHOR
- * Michael Mi
- * Email: michael.mi@sun.com
- ******************************************************************************/
-{
- bool rc = false;
-
- std::vector< const ElementCollector* >::const_iterator jj = m_vElementCollectors.begin();
-
- for( ; jj != m_vElementCollectors.end() ; ++jj )
- {
- ElementCollector* pElementCollector = (ElementCollector*)*jj;
- if (nIgnoredSecurityId == cssxc::sax::ConstOfSecurityId::UNDEFINEDSECURITYID ||
- pElementCollector->getSecurityId() != nIgnoredSecurityId)
- {
- rc = true;
- break;
- }
- }
-
- if ( !rc )
- {
- std::vector< const BufferNode* >::const_iterator ii = m_vChildren.begin();
-
- for( ; ii != m_vChildren.end() ; ++ii )
- {
- BufferNode* pBufferNode = (BufferNode*)*ii;
-
- if ( pBufferNode->isECInSubTreeIncluded(nIgnoredSecurityId))
- {
- rc = true;
- break;
- }
- }
- }
-
- return rc;
-}
-
-bool BufferNode::isECOfBeforeModifyInAncestorIncluded(sal_Int32 nIgnoredSecurityId) const
-/****** BufferNode/isECOfBeforeModifyInAncestorIncluded **********************
- *
- * NAME
- * isECOfBeforeModifyInAncestorIncluded -- checks whether there is some
- * ancestor BufferNode which has ElementCollector with PRI_BEFPREMODIFY
- * priority.
- *
- * SYNOPSIS
- * bExist = isECOfBeforeModifyInAncestorIncluded(nIgnoredSecurityId);
- *
- * FUNCTION
- * checks each ancestor BufferNode through the parent link, if there is
- * an ElementCollector with PRI_BEFPREMODIFY priority and its
- * signatureId is not ignored, then return true, otherwise, false
- * returned.
- *
- * INPUTS
- * nIgnoredSecurityId - the security Id to be ignored. If it equals
- * to UNDEFINEDSECURITYID, then no security Id
- * will be ignored.
- *
- * RESULT
- * bExist - true if a match found, false otherwise.
- *
- * AUTHOR
- * Michael Mi
- * Email: michael.mi@sun.com
- ******************************************************************************/
-{
- bool rc = false;
-
- BufferNode* pParentNode = m_pParent;
- while (pParentNode != NULL)
- {
- if (pParentNode->isECOfBeforeModifyIncluded(nIgnoredSecurityId))
- {
- rc = true;
- break;
- }
-
- pParentNode = (BufferNode*)pParentNode->getParent();
- }
-
- return rc;
-}
-
-bool BufferNode::isBlockerInSubTreeIncluded(sal_Int32 nIgnoredSecurityId) const
-/****** BufferNode/isBlockerInSubTreeIncluded ********************************
- *
- * NAME
- * isBlockerInSubTreeIncluded -- checks whether there is some BufferNode
- * which has blocker on it
- *
- * SYNOPSIS
- * bExist = isBlockerInSubTreeIncluded(nIgnoredSecurityId);
- *
- * FUNCTION
- * checks each BufferNode in the branch of this BufferNode, if one has
- * a blocker on it, and the blocker's securityId is not ignored, then
- * returns true; otherwise, false returns.
- *
- * INPUTS
- * nIgnoredSecurityId - the security Id to be ignored. If it equals
- * to UNDEFINEDSECURITYID, then no security Id
- * will be ignored.
- *
- * RESULT
- * bExist - true if a match found, false otherwise.
- *
- * AUTHOR
- * Michael Mi
- * Email: michael.mi@sun.com
- ******************************************************************************/
-{
- bool rc = false;
-
- std::vector< const BufferNode* >::const_iterator ii = m_vChildren.begin();
-
- for( ; ii != m_vChildren.end() ; ++ii )
- {
- BufferNode* pBufferNode = (BufferNode*)*ii;
- ElementMark* pBlocker = pBufferNode->getBlocker();
-
- if (pBlocker != NULL &&
- (nIgnoredSecurityId == cssxc::sax::ConstOfSecurityId::UNDEFINEDSECURITYID ||
- pBlocker->getSecurityId() != nIgnoredSecurityId ))
- {
- rc = true;
- break;
- }
-
- if (rc || pBufferNode->isBlockerInSubTreeIncluded(nIgnoredSecurityId))
- {
- rc = true;
- break;
- }
- }
-
- return rc;
-}
-
-const BufferNode* BufferNode::getNextChild(const BufferNode* pChild) const
-/****** BufferNode/getNextChild **********************************************
- *
- * NAME
- * getNextChild -- get the next child BufferNode.
- *
- * SYNOPSIS
- * nextChild = getNextChild();
- *
- * FUNCTION
- * see NAME
- *
- * INPUTS
- * pChild - the child BufferNode whose next node is retrieved.
- *
- * RESULT
- * nextChild - the next child BufferNode after the pChild, or NULL if
- * there is none.
- *
- * AUTHOR
- * Michael Mi
- * Email: michael.mi@sun.com
- ******************************************************************************/
-{
- BufferNode* rc = NULL;
- bool bChildFound = false;
-
- std::vector< const BufferNode* >::const_iterator ii = m_vChildren.begin();
- for( ; ii != m_vChildren.end() ; ++ii )
- {
- if (bChildFound)
- {
- rc = (BufferNode*)*ii;
- break;
- }
-
- if( *ii == pChild )
- {
- bChildFound = true;
- }
- }
-
- return (const BufferNode*)rc;
-}
-
-
-void BufferNode::freeAllChildren()
-/****** BufferNode/freeAllChildren *******************************************
- *
- * NAME
- * freeAllChildren -- free all his child BufferNode.
- *
- * SYNOPSIS
- * freeAllChildren();
- *
- * FUNCTION
- * see NAME
- *
- * INPUTS
- * empty
- *
- * RESULT
- * empty
- *
- * AUTHOR
- * Michael Mi
- * Email: michael.mi@sun.com
- ******************************************************************************/
-{
- std::vector< const BufferNode* >::const_iterator ii = m_vChildren.begin();
- for( ; ii != m_vChildren.end() ; ++ii )
- {
- BufferNode *pChild = (BufferNode *)(*ii);
- pChild->freeAllChildren();
- delete pChild;
- }
-
- m_vChildren.clear();
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmlsecurity/source/framework/buffernode.hxx b/xmlsecurity/source/framework/buffernode.hxx
deleted file mode 100644
index 76c3c2b8d..000000000
--- a/xmlsecurity/source/framework/buffernode.hxx
+++ /dev/null
@@ -1,136 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * 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
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _BUFFERNODE_HXX
-#define _BUFFERNODE_HXX
-
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/xml/wrapper/XXMLElementWrapper.hpp>
-
-#ifndef INCLUDED_VECTOR
-#include <vector>
-#define INCLUDED_VECTOR
-#endif
-
-class ElementMark;
-class ElementCollector;
-
-class BufferNode
-/****** buffernode.hxx/CLASS BufferNode ***************************************
- *
- * NAME
- * BufferNode -- Class to maintain the tree of bufferred elements
- *
- * FUNCTION
- * One BufferNode object represents a bufferred element in the document
- * wrapper component.
- * All BufferNode objects construct a tree which has the same structure
- * of all bufferred elements. That is to say, if one bufferred element is
- * an ancestor of another bufferred element, then the corresponding
- * BufferNode objects are also in ancestor/descendant relationship.
- * This class is used to manipulate the tree of bufferred elements.
- *
- * AUTHOR
- * Michael Mi
- * Email: michael.mi@sun.com
- ******************************************************************************/
-{
-private:
- /* the parent BufferNode */
- BufferNode* m_pParent;
-
- /* all child BufferNodes */
- std::vector< const BufferNode* > m_vChildren;
-
- /* all ElementCollector holding this BufferNode */
- std::vector< const ElementCollector* > m_vElementCollectors;
-
- /*
- * the blocker holding this BufferNode, one BufferNode can have one
- * blocker at most
- */
- ElementMark* m_pBlocker;
-
- /*
- * whether the element has completely bufferred by the document wrapper
- * component
- */
- bool m_bAllReceived;
-
- /* the XMLElementWrapper of the bufferred element */
- com::sun::star::uno::Reference<
- com::sun::star::xml::wrapper::XXMLElementWrapper > m_xXMLElement;
-
-private:
- bool isECInSubTreeIncluded(sal_Int32 nIgnoredSecurityId) const;
- bool isECOfBeforeModifyInAncestorIncluded(sal_Int32 nIgnoredSecurityId) const;
- bool isBlockerInSubTreeIncluded(sal_Int32 nIgnoredSecurityId) const;
- const BufferNode* getNextChild(const BufferNode* pChild) const;
-
-public:
- explicit BufferNode(
- const com::sun::star::uno::Reference<
- com::sun::star::xml::wrapper::XXMLElementWrapper >& xXMLElement);
- virtual ~BufferNode() {};
-
- bool isECOfBeforeModifyIncluded(sal_Int32 nIgnoredSecurityId) const;
- void setReceivedAll();
- bool isAllReceived() const;
- void addElementCollector(const ElementCollector* pElementCollector);
- void removeElementCollector(const ElementCollector* pElementCollector);
- ElementMark* getBlocker() const;
- void setBlocker(const ElementMark* pBlocker);
- rtl::OUString printChildren() const;
- bool hasAnything() const;
- bool hasChildren() const;
- std::vector< const BufferNode* >* getChildren() const;
- const BufferNode* getFirstChild() const;
- void addChild(const BufferNode* pChild, sal_Int32 nPosition);
- void addChild(const BufferNode* pChild);
- void removeChild(const BufferNode* pChild);
- sal_Int32 indexOfChild(const BufferNode* pChild) const;
- const BufferNode* childAt(sal_Int32 nIndex) const;
- const BufferNode* getParent() const;
- void setParent(const BufferNode* pParent);
- const BufferNode* getNextSibling() const;
- const BufferNode* isAncestor(const BufferNode* pDescendant) const;
- bool isPrevious(const BufferNode* pFollowing) const;
- const BufferNode* getNextNodeByTreeOrder() const;
- com::sun::star::uno::Reference<
- com::sun::star::xml::wrapper::XXMLElementWrapper > getXMLElement() const;
- void setXMLElement(const com::sun::star::uno::Reference<
- com::sun::star::xml::wrapper::XXMLElementWrapper >& xXMLElement);
- void notifyBranch();
- void notifyAncestor();
- void elementCollectorNotify();
- void freeAllChildren();
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmlsecurity/source/framework/decryptorimpl.cxx b/xmlsecurity/source/framework/decryptorimpl.cxx
deleted file mode 100644
index a3d9e951a..000000000
--- a/xmlsecurity/source/framework/decryptorimpl.cxx
+++ /dev/null
@@ -1,238 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * 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
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_xmlsecurity.hxx"
-
-#include "decryptorimpl.hxx"
-#include <com/sun/star/xml/crypto/XXMLEncryptionTemplate.hpp>
-#include <com/sun/star/xml/wrapper/XXMLElementWrapper.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-
-namespace cssu = com::sun::star::uno;
-namespace cssl = com::sun::star::lang;
-namespace cssxc = com::sun::star::xml::crypto;
-namespace cssxw = com::sun::star::xml::wrapper;
-
-#define SERVICE_NAME "com.sun.star.xml.crypto.sax.Decryptor"
-#define IMPLEMENTATION_NAME "com.sun.star.xml.security.framework.DecryptorImpl"
-
-#define DECLARE_ASCII( SASCIIVALUE ) \
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SASCIIVALUE ) )
-
-DecryptorImpl::DecryptorImpl( const cssu::Reference< cssl::XMultiServiceFactory >& rxMSF)
-{
- mxMSF = rxMSF;
-}
-
-DecryptorImpl::~DecryptorImpl()
-{
-}
-
-bool DecryptorImpl::checkReady() const
-/****** DecryptorImpl/checkReady *********************************************
- *
- * NAME
- * checkReady -- checks the conditions for the decryption.
- *
- * SYNOPSIS
- * bReady = checkReady( );
- *
- * FUNCTION
- * checks whether all following conditions are satisfied:
- * 1. the result listener is ready;
- * 2. the EncryptionEngine is ready.
- *
- * INPUTS
- * empty
- *
- * RESULT
- * bReady - true if all conditions are satisfied, false otherwise
- *
- * AUTHOR
- * Michael Mi
- * Email: michael.mi@sun.com
- ******************************************************************************/
-{
- return (m_xResultListener.is() && EncryptionEngine::checkReady());
-}
-
-void DecryptorImpl::notifyResultListener() const
- throw (cssu::Exception, cssu::RuntimeException)
-/****** DecryptorImpl/notifyResultListener ***********************************
- *
- * NAME
- * notifyResultListener -- notifies the listener about the decryption
- * result.
- *
- * SYNOPSIS
- * notifyResultListener( );
- *
- * FUNCTION
- * see NAME.
- *
- * INPUTS
- * empty
- *
- * RESULT
- * empty
- *
- * AUTHOR
- * Michael Mi
- * Email: michael.mi@sun.com
- ******************************************************************************/
-{
- cssu::Reference< cssxc::sax::XDecryptionResultListener >
- xDecryptionResultListener ( m_xResultListener , cssu::UNO_QUERY ) ;
-
- xDecryptionResultListener->decrypted(m_nSecurityId,m_nStatus);
-}
-
-void DecryptorImpl::startEngine( const cssu::Reference<
- cssxc::XXMLEncryptionTemplate >&
- xEncryptionTemplate)
- throw (cssu::Exception, cssu::RuntimeException)
-/****** DecryptorImpl/startEngine ********************************************
- *
- * NAME
- * startEngine -- decrypts the encryption.
- *
- * SYNOPSIS
- * startEngine( xEncryptionTemplate );
- *
- * FUNCTION
- * decrypts the encryption element, then if succeeds, updates the link
- * of old template element to the new encryption element in
- * SAXEventKeeper.
- *
- * INPUTS
- * xEncryptionTemplate - the encryption template to be decrypted.
- *
- * RESULT
- * empty
- *
- * AUTHOR
- * Michael Mi
- * Email: michael.mi@sun.com
- ******************************************************************************/
-{
- cssu::Reference< cssxc::XXMLEncryptionTemplate > xResultTemplate;
- try
- {
- xResultTemplate = m_xXMLEncryption->decrypt(xEncryptionTemplate, m_xXMLSecurityContext);
- m_nStatus = xResultTemplate->getStatus();
- }
- catch( cssu::Exception& )
- {
- m_nStatus = cssxc::SecurityOperationStatus_RUNTIMEERROR_FAILED;
- }
-
- if (m_nStatus == cssxc::SecurityOperationStatus_OPERATION_SUCCEEDED)
- {
- cssu::Reference< cssxw::XXMLElementWrapper > xDecryptedElement
- = xResultTemplate->getTemplate();
- m_xSAXEventKeeper->setElement(m_nIdOfTemplateEC, xDecryptedElement);
- }
-}
-
-/* XDecryptionResultBroadcaster */
-void SAL_CALL DecryptorImpl::addDecryptionResultListener( const cssu::Reference< cssxc::sax::XDecryptionResultListener >& listener )
- throw (cssu::Exception, cssu::RuntimeException)
-{
- m_xResultListener = listener;
- tryToPerform();
-}
-
-void SAL_CALL DecryptorImpl::removeDecryptionResultListener( const cssu::Reference< cssxc::sax::XDecryptionResultListener >&)
- throw (cssu::RuntimeException)
-{
-}
-
-/* XInitialization */
-void SAL_CALL DecryptorImpl::initialize( const cssu::Sequence< cssu::Any >& aArguments )
- throw (cssu::Exception, cssu::RuntimeException)
-{
- OSL_ASSERT(aArguments.getLength() == 5);
-
- rtl::OUString ouTempString;
-
- aArguments[0] >>= ouTempString;
- m_nSecurityId = ouTempString.toInt32();
- aArguments[1] >>= m_xSAXEventKeeper;
- aArguments[2] >>= ouTempString;
- m_nIdOfTemplateEC = ouTempString.toInt32();
- aArguments[3] >>= m_xXMLSecurityContext;
- aArguments[4] >>= m_xXMLEncryption;
-}
-
-rtl::OUString DecryptorImpl_getImplementationName ()
- throw (cssu::RuntimeException)
-{
- return rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( IMPLEMENTATION_NAME ) );
-}
-
-sal_Bool SAL_CALL DecryptorImpl_supportsService( const rtl::OUString& ServiceName )
- throw (cssu::RuntimeException)
-{
- return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( SERVICE_NAME ));
-}
-
-cssu::Sequence< rtl::OUString > SAL_CALL DecryptorImpl_getSupportedServiceNames( )
- throw (cssu::RuntimeException)
-{
- cssu::Sequence < rtl::OUString > aRet(1);
- rtl::OUString* pArray = aRet.getArray();
- pArray[0] = rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME ) );
- return aRet;
-}
-#undef SERVICE_NAME
-
-cssu::Reference< cssu::XInterface > SAL_CALL DecryptorImpl_createInstance( const cssu::Reference< cssl::XMultiServiceFactory >& rSMgr)
- throw( cssu::Exception )
-{
- return (cppu::OWeakObject*) new DecryptorImpl(rSMgr);
-}
-
-/* XServiceInfo */
-rtl::OUString SAL_CALL DecryptorImpl::getImplementationName( )
- throw (cssu::RuntimeException)
-{
- return DecryptorImpl_getImplementationName();
-}
-sal_Bool SAL_CALL DecryptorImpl::supportsService( const rtl::OUString& rServiceName )
- throw (cssu::RuntimeException)
-{
- return DecryptorImpl_supportsService( rServiceName );
-}
-cssu::Sequence< rtl::OUString > SAL_CALL DecryptorImpl::getSupportedServiceNames( )
- throw (cssu::RuntimeException)
-{
- return DecryptorImpl_getSupportedServiceNames();
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmlsecurity/source/framework/decryptorimpl.hxx b/xmlsecurity/source/framework/decryptorimpl.hxx
deleted file mode 100644
index 3a40d110f..000000000
--- a/xmlsecurity/source/framework/decryptorimpl.hxx
+++ /dev/null
@@ -1,134 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * 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
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _DECRYPTORIMPL_HXX
-#define _DECRYPTORIMPL_HXX
-
-#include <com/sun/star/xml/crypto/sax/XDecryptionResultBroadcaster.hpp>
-#include <com/sun/star/xml/crypto/sax/XDecryptionResultListener.hpp>
-#include <com/sun/star/xml/crypto/XXMLSecurityContext.hpp>
-#include <com/sun/star/lang/XInitialization.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <cppuhelper/implbase3.hxx>
-
-#include "encryptionengine.hxx"
-
-class DecryptorImpl : public cppu::ImplInheritanceHelper3
-<
- EncryptionEngine,
- com::sun::star::xml::crypto::sax::XDecryptionResultBroadcaster,
- com::sun::star::lang::XInitialization,
- com::sun::star::lang::XServiceInfo
->
-/****** DecryptorImpl.hxx/CLASS DecryptorImpl *********************************
- *
- * NAME
- * DecryptorImpl -- decrypts an encryption
- *
- * FUNCTION
- * Collects all resources for decrypting an encryption, then decrypts the
- * encryption by invoking a xmlsec-based encryption bridge component.
- *
- * AUTHOR
- * Michael Mi
- * Email: michael.mi@sun.com
- ******************************************************************************/
-{
-private:
- /*
- * the Id of the encryption, which is used for the result listener to
- * identify the encryption.
- */
- sal_Int32 m_nEncryptionId;
-
- /*
- * the decryption result,
- * remembers whether the decryption succeeds.
- */
- bool m_bDecryptionSucceed;
-
- com::sun::star::uno::Reference<
- com::sun::star::xml::crypto::XXMLSecurityContext > m_xXMLSecurityContext;
-
- virtual void notifyResultListener() const
- throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException);
- virtual bool checkReady() const;
- virtual void startEngine( const com::sun::star::uno::Reference<
- com::sun::star::xml::crypto::XXMLEncryptionTemplate >&
- xEncryptionTemplate)
- throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException);
-
-public:
- explicit DecryptorImpl( const com::sun::star::uno::Reference<
- com::sun::star::lang::XMultiServiceFactory >& rxMSF);
- virtual ~DecryptorImpl();
-
- /* XDecryptionResultBroadcaster */
- virtual void SAL_CALL addDecryptionResultListener(
- const com::sun::star::uno::Reference<
- com::sun::star::xml::crypto::sax::XDecryptionResultListener >&
- listener )
- throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeDecryptionResultListener(
- const com::sun::star::uno::Reference<
- com::sun::star::xml::crypto::sax::XDecryptionResultListener >&
- listener )
- throw (com::sun::star::uno::RuntimeException);
-
- /* XInitialization */
- virtual void SAL_CALL initialize(
- const com::sun::star::uno::Sequence< com::sun::star::uno::Any >& aArguments )
- throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException);
-
- /* XServiceInfo */
- virtual rtl::OUString SAL_CALL getImplementationName( )
- throw (com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsService( const rtl::OUString& ServiceName )
- throw (com::sun::star::uno::RuntimeException);
- virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames( )
- throw (com::sun::star::uno::RuntimeException);
-};
-
-rtl::OUString DecryptorImpl_getImplementationName()
- throw ( com::sun::star::uno::RuntimeException );
-
-sal_Bool SAL_CALL DecryptorImpl_supportsService( const rtl::OUString& ServiceName )
- throw ( com::sun::star::uno::RuntimeException );
-
-com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL DecryptorImpl_getSupportedServiceNames( )
- throw ( com::sun::star::uno::RuntimeException );
-
-com::sun::star::uno::Reference< com::sun::star::uno::XInterface >
-SAL_CALL DecryptorImpl_createInstance(
- const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >&
- rSMgr)
- throw ( com::sun::star::uno::Exception );
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmlsecurity/source/framework/elementcollector.cxx b/xmlsecurity/source/framework/elementcollector.cxx
deleted file mode 100644
index 841900ae9..000000000
--- a/xmlsecurity/source/framework/elementcollector.cxx
+++ /dev/null
@@ -1,273 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * 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
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_xmlsecurity.hxx"
-
-#include "elementmark.hxx"
-#include "elementcollector.hxx"
-#include "buffernode.hxx"
-#include <com/sun/star/xml/crypto/sax/ConstOfSecurityId.hpp>
-
-namespace cssu = com::sun::star::uno;
-namespace cssxc = com::sun::star::xml::crypto;
-
-ElementCollector::ElementCollector(
- sal_Int32 nSecurityId,
- sal_Int32 nBufferId,
- cssxc::sax::ElementMarkPriority nPriority,
- bool bToModify,
- const com::sun::star::uno::Reference<
- com::sun::star::xml::crypto::sax::XReferenceResolvedListener >&
- xReferenceResolvedListener)
- :ElementMark(nSecurityId, nBufferId),
- m_nPriority(nPriority),
- m_bToModify(bToModify),
- m_bAbleToNotify(false),
- m_bNotified(false),
- m_xReferenceResolvedListener(xReferenceResolvedListener)
-/****** ElementCollector/ElementCollector *************************************
- *
- * NAME
- * ElementCollector -- constructor method
- *
- * SYNOPSIS
- * ElementCollector(nSecurityId, nBufferId, nPriority, bToModify
- * xReferenceResolvedListener);
- *
- * FUNCTION
- * construct an ElementCollector object.
- *
- * INPUTS
- * nSecurityId - represents which security entity the buffer node is
- * related with. Either a signature or an encryption is
- * a security entity.
- * nBufferId - the id of the element bufferred in the document
- * wrapper component. The document wrapper component
- * uses this id to search the particular bufferred
- * element.
- * nPriority - the priority value. ElementCollector with lower
- * priority value can't notify until all ElementCollectors
- * with higher priority value have notified.
- * bToModify - A flag representing whether this ElementCollector
- * notification will cause the modification of its working
- * element.
- * xReferenceResolvedListener
- * - the listener that this ElementCollector notifies to.
- *
- * RESULT
- * empty
- *
- * AUTHOR
- * Michael Mi
- * Email: michael.mi@sun.com
- ******************************************************************************/
-{
- m_type = cssxc::sax::ElementMarkType_ELEMENTCOLLECTOR;
-}
-
-cssxc::sax::ElementMarkPriority ElementCollector::getPriority() const
-{
- return m_nPriority;
-}
-
-bool ElementCollector::getModify() const
-{
- return m_bToModify;
-}
-
-void ElementCollector::notifyListener()
-/****** ElementCollector/notifyListener ***************************************
- *
- * NAME
- * notifyListener -- enable the ability to notify the listener
- *
- * SYNOPSIS
- * notifyListener();
- *
- * FUNCTION
- * enable the ability to notify the listener and try to notify then.
- *
- * INPUTS
- * empty
- *
- * RESULT
- * empty
- *
- * AUTHOR
- * Michael Mi
- * Email: michael.mi@sun.com
- ******************************************************************************/
-{
- m_bAbleToNotify = true;
- doNotify();
-}
-
-bool ElementCollector::isAbleToNotify() const
-{
- return m_bAbleToNotify;
-}
-
-void ElementCollector::setReferenceResolvedListener(
- const cssu::Reference< cssxc::sax::XReferenceResolvedListener >& xReferenceResolvedListener)
-/****** ElementCollector/setReferenceResolvedListener *************************
- *
- * NAME
- * setReferenceResolvedListener -- configures a listener for the buffer
- * node in this object
- *
- * SYNOPSIS
- * setReferenceResolvedListener(xReferenceResolvedListener);
- *
- * FUNCTION
- * configures a new listener and try to notify then.
- *
- * INPUTS
- * xReferenceResolvedListener - the new listener
- *
- * RESULT
- * empty
- *
- * AUTHOR
- * Michael Mi
- * Email: michael.mi@sun.com
- ******************************************************************************/
-{
- m_xReferenceResolvedListener = xReferenceResolvedListener;
- doNotify();
-}
-
-void ElementCollector::setSecurityId(sal_Int32 nSecurityId)
-/****** ElementCollector/setSecurityId ****************************************
- *
- * NAME
- * setSecurityId -- configures the security Id of the buffer node
- *
- * SYNOPSIS
- * setSecurityId(nSecurityId);
- *
- * FUNCTION
- * configures the security Id and try to notify then
- *
- * INPUTS
- * nSecurityId - the security Id
- *
- * RESULT
- * empty
- *
- * AUTHOR
- * Michael Mi
- * Email: michael.mi@sun.com
- ******************************************************************************/
-{
- m_nSecurityId = nSecurityId;
- doNotify();
-}
-
-void ElementCollector::doNotify()
-/****** ElementCollector/doNotify *********************************************
- *
- * NAME
- * doNotify -- tries to notify the listener
- *
- * SYNOPSIS
- * doNotify();
- *
- * FUNCTION
- * notifies the listener when all below conditions are satisfied:
- * the listener has not been notified;
- * the notify right is granted;
- * the listener has already been configured;
- * the security id has already been configure
- *
- * INPUTS
- * empty
- *
- * RESULT
- * empty
- *
- * AUTHOR
- * Michael Mi
- * Email: michael.mi@sun.com
- ******************************************************************************/
-{
- if (!m_bNotified &&
- m_bAbleToNotify &&
- m_xReferenceResolvedListener.is() &&
- m_nSecurityId != cssxc::sax::ConstOfSecurityId::UNDEFINEDSECURITYID)
- {
- m_bNotified = true;
- m_xReferenceResolvedListener->referenceResolved(m_nBufferId);
- }
-}
-
-ElementCollector* ElementCollector::clone(
- sal_Int32 nBufferId,
- cssxc::sax::ElementMarkPriority nPriority ) const
-/****** ElementCollector/clone ************************************************
- *
- * NAME
- * clone -- duplicates this ElementCollector object
- *
- * SYNOPSIS
- * cloned = clone(nBufferId, nPriority);
- *
- * FUNCTION
- * duplicates this ElementCollector object with new buffer Id, priority.
- *
- * INPUTS
- * nBufferId - the buffer node's Id
- * nPriority - the priority
- *
- * RESULT
- * clone - a new ElementCollector
- *
- * AUTHOR
- * Michael Mi
- * Email: michael.mi@sun.com
- ******************************************************************************/
-{
- ElementCollector* pClonedOne
- = new ElementCollector(m_nSecurityId,
- nBufferId, nPriority, m_bToModify,
- m_xReferenceResolvedListener);
-
- if (m_bAbleToNotify)
- {
- pClonedOne->notifyListener();
- }
-
- if (m_pBufferNode != NULL)
- {
- m_pBufferNode->addElementCollector(pClonedOne);
- }
-
- return pClonedOne;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmlsecurity/source/framework/elementcollector.hxx b/xmlsecurity/source/framework/elementcollector.hxx
deleted file mode 100644
index 41bb0549d..000000000
--- a/xmlsecurity/source/framework/elementcollector.hxx
+++ /dev/null
@@ -1,106 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * 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
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _ELEMENTCOLLECTOR_HXX
-#define _ELEMENTCOLLECTOR_HXX
-
-#include "elementmark.hxx"
-#include <com/sun/star/xml/crypto/sax/XReferenceResolvedListener.hpp>
-#include <com/sun/star/xml/crypto/sax/ElementMarkPriority.hpp>
-
-class ElementCollector : public ElementMark
-/****** elementcollector.hxx/CLASS ElementCollector ***************************
- *
- * NAME
- * ElementCollector -- Class to manipulate an element collector
- *
- * FUNCTION
- * This class is derived from the ElementMark class. Beyond the function
- * of the ElementMark class, this class also maintains the priority, and
- * manages the notify process
- *
- * AUTHOR
- * Michael Mi
- * Email: michael.mi@sun.com
- ******************************************************************************/
-{
-private:
- /*
- * the notify priority, is one of following values:
- * AFTERMODIFY - this ElementCollector will notify after all
- * internal modifications have finished.
- * BEFOREMODIFY - this ElementCollector must notify before any
- * internal modification happens.
- */
- com::sun::star::xml::crypto::sax::ElementMarkPriority m_nPriority;
-
- /*
- * the modify flag, representing whether which elementcollector will
- * modify its data.
- */
- bool m_bToModify;
-
- /* the notify enable flag, see notifyListener method */
- bool m_bAbleToNotify;
-
- /* whether the listener has been notified */
- bool m_bNotified;
-
- /* the listener to be notified */
- com::sun::star::uno::Reference<
- com::sun::star::xml::crypto::sax::XReferenceResolvedListener > m_xReferenceResolvedListener;
-
-public:
- ElementCollector(
- sal_Int32 nSecurityId,
- sal_Int32 nBufferId,
- com::sun::star::xml::crypto::sax::ElementMarkPriority nPriority,
- bool bToModify,
- const com::sun::star::uno::Reference<
- com::sun::star::xml::crypto::sax::XReferenceResolvedListener >&
- xReferenceResolvedListener);
- virtual ~ElementCollector() {};
-
- com::sun::star::xml::crypto::sax::ElementMarkPriority getPriority() const;
- bool getModify() const;
- void notifyListener();
- bool isAbleToNotify() const;
- void setReferenceResolvedListener(
- const com::sun::star::uno::Reference<
- com::sun::star::xml::crypto::sax::XReferenceResolvedListener >&
- referenceResolvedListener);
- void setSecurityId(sal_Int32 nSecurityId);
- void doNotify();
- ElementCollector* clone(
- sal_Int32 nId,
- com::sun::star::xml::crypto::sax::ElementMarkPriority nPriority ) const;
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmlsecurity/source/framework/elementmark.cxx b/xmlsecurity/source/framework/elementmark.cxx
deleted file mode 100644
index ef2b6329f..000000000
--- a/xmlsecurity/source/framework/elementmark.cxx
+++ /dev/null
@@ -1,104 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * 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
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_xmlsecurity.hxx"
-
-#include "elementmark.hxx"
-#include "buffernode.hxx"
-
-namespace cssxc = com::sun::star::xml::crypto;
-
-ElementMark::ElementMark(sal_Int32 nSecurityId, sal_Int32 nBufferId)
- :m_pBufferNode(NULL),
- m_nSecurityId(nSecurityId),
- m_nBufferId(nBufferId),
- m_type(cssxc::sax::ElementMarkType_ELEMENTMARK)
-/****** ElementMark/ElementMark ***********************************************
- *
- * NAME
- * ElementMark -- constructor method
- *
- * SYNOPSIS
- * ElementMark(nSecurityId, nBufferId);
- *
- * FUNCTION
- * construct an ElementMark object.
- *
- * INPUTS
- * nSecurityId - represents which security entity the buffer node is
- * related with. Either a signature or an encryption is
- * a security entity.
- * nBufferId - the id of the element bufferred in the document
- * wrapper component. The document wrapper component
- * uses this id to search the particular bufferred
- * element.
- *
- * RESULT
- * empty
- *
- * AUTHOR
- * Michael Mi
- * Email: michael.mi@sun.com
- ******************************************************************************/
-{
-}
-
-BufferNode* ElementMark::getBufferNode() const
-{
- return m_pBufferNode;
-}
-
-void ElementMark::setBufferNode(const BufferNode* pBufferNode)
-{
- m_pBufferNode = (BufferNode*)pBufferNode;
-}
-
-sal_Int32 ElementMark::getSecurityId() const
-{
- return m_nSecurityId;
-}
-
-void ElementMark::setSecurityId(sal_Int32 nSecurityId)
-{
- m_nSecurityId = nSecurityId;
-}
-
-com::sun::star::xml::crypto::sax::ElementMarkType ElementMark::getType() const
-{
- return m_type;
-}
-
-sal_Int32 ElementMark::getBufferId() const
-{
- return m_nBufferId;
-}
-
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmlsecurity/source/framework/elementmark.hxx b/xmlsecurity/source/framework/elementmark.hxx
deleted file mode 100644
index 0007d1b04..000000000
--- a/xmlsecurity/source/framework/elementmark.hxx
+++ /dev/null
@@ -1,84 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * 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
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _ELEMENTMARK_HXX
-#define _ELEMENTMARK_HXX
-
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/xml/crypto/sax/ElementMarkType.hpp>
-
-class BufferNode;
-
-class ElementMark
-/****** elementmark.hxx/CLASS ElementMark *************************************
- *
- * NAME
- * ElementMark -- Class to manipulate an element mark
- *
- * FUNCTION
- * This class maintains the security id, buffer id and its type for a
- * buffer node.
- *
- * AUTHOR
- * Michael Mi
- * Email: michael.mi@sun.com
- ******************************************************************************/
-{
-protected:
- /* the BufferNode maintained by this object */
- BufferNode* m_pBufferNode;
-
- /* the security Id */
- sal_Int32 m_nSecurityId;
-
- /* the buffer Id */
- sal_Int32 m_nBufferId;
-
- /*
- * the type value, is one of following values:
- * TYPEOFELEMENTMARK - the default value, represents an blocker if
- * not changed
- * TYPEOFELEMENTCOLLECTOR - represents an ElementCollector
- */
- com::sun::star::xml::crypto::sax::ElementMarkType m_type;
-
-public:
- ElementMark(sal_Int32 nSecurityId, sal_Int32 nBufferId);
- virtual ~ElementMark() {};
-
- BufferNode* getBufferNode() const;
- void setBufferNode(const BufferNode* pBufferNode);
- sal_Int32 getSecurityId() const;
- void setSecurityId(sal_Int32 nSecurityId);
- com::sun::star::xml::crypto::sax::ElementMarkType getType() const;
- sal_Int32 getBufferId() const;
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmlsecurity/source/framework/encryptionengine.cxx b/xmlsecurity/source/framework/encryptionengine.cxx
deleted file mode 100644
index b6dcae03f..000000000
--- a/xmlsecurity/source/framework/encryptionengine.cxx
+++ /dev/null
@@ -1,209 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * 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
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_xmlsecurity.hxx"
-
-#include "encryptionengine.hxx"
-#include <com/sun/star/xml/crypto/XXMLEncryptionTemplate.hpp>
-#include <com/sun/star/xml/wrapper/XXMLElementWrapper.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-
-namespace cssu = com::sun::star::uno;
-namespace cssl = com::sun::star::lang;
-namespace cssxc = com::sun::star::xml::crypto;
-namespace cssxw = com::sun::star::xml::wrapper;
-
-#define ENCRYPTION_TEMPLATE "com.sun.star.xml.crypto.XMLEncryptionTemplate"
-
-#define DECLARE_ASCII( SASCIIVALUE ) \
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SASCIIVALUE ) )
-
-EncryptionEngine::EncryptionEngine( )
- :m_nIdOfBlocker(-1)
-{
-}
-
-bool EncryptionEngine::checkReady() const
-/****** EncryptionEngine/checkReady ******************************************
- *
- * NAME
- * checkReady -- checks the conditions for the main operation.
- *
- * SYNOPSIS
- * 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 id of the template blocker is known;
- * 4. both the key element and the encryption template
- * are bufferred.
- *
- * INPUTS
- * empty
- *
- * RESULT
- * bReady - true if all conditions are satisfied, false otherwise
- *
- * AUTHOR
- * Michael Mi
- * Email: michael.mi@sun.com
- ******************************************************************************/
-{
- bool rc = true;
-
- sal_Int32 nKeyInc = 0;
- if (m_nIdOfKeyEC != 0)
- {
- nKeyInc = 1;
- }
-
- if (m_bMissionDone ||
- m_nIdOfKeyEC == -1 ||
- m_nIdOfBlocker == -1 ||
- 1+nKeyInc > m_nNumOfResolvedReferences )
- {
- rc = false;
- }
-
- return rc;
-}
-
-void EncryptionEngine::tryToPerform( )
- throw (cssu::Exception, cssu::RuntimeException)
-/****** EncryptionEngine/tryToPerform ****************************************
- *
- * NAME
- * tryToPerform -- tries to perform the encryption/decryption operation.
- *
- * SYNOPSIS
- * tryToPerform( );
- *
- * FUNCTION
- * if the situation is ready, perform following operations.
- * 1. prepares a encryption template;
- * 2. calls the encryption bridge component;
- * 3. clears up all used resources;
- * 4. notifies the result listener;
- * 5. sets the "accomplishment" flag.
- *
- * INPUTS
- * empty
- *
- * RESULT
- * empty
- *
- * AUTHOR
- * Michael Mi
- * Email: michael.mi@sun.com
- ******************************************************************************/
-{
- if (checkReady())
- {
- const rtl::OUString sEncryptionTemplate (
- RTL_CONSTASCII_USTRINGPARAM( ENCRYPTION_TEMPLATE ) );
- cssu::Reference < cssxc::XXMLEncryptionTemplate > xEncryptionTemplate(
- mxMSF->createInstance( sEncryptionTemplate ), cssu::UNO_QUERY );
-
- OSL_ASSERT( xEncryptionTemplate.is() );
-
- cssu::Reference< cssxw::XXMLElementWrapper > xXMLElement
- = m_xSAXEventKeeper->getElement( m_nIdOfTemplateEC );
-
- xEncryptionTemplate->setTemplate(xXMLElement);
-
- startEngine( xEncryptionTemplate );
-
- /*
- * done
- */
- clearUp( );
-
- notifyResultListener();
-
- m_bMissionDone = true;
- }
-}
-
-void EncryptionEngine::clearUp( ) const
-/****** EncryptionEngine/clearup *********************************************
- *
- * NAME
- * clearUp -- clear up all resources used by this operation.
- *
- * SYNOPSIS
- * clearUp( );
- *
- * FUNCTION
- * cleaning resources up includes:
- * 1. releases the ElementCollector for the encryption template element;
- * 2. releases the Blocker for the encryption template element;
- * 3. releases the ElementCollector for the key element, if there is one.
- *
- * INPUTS
- * empty
- *
- * RESULT
- * empty
- *
- * AUTHOR
- * Michael Mi
- * Email: michael.mi@sun.com
- ******************************************************************************/
-{
- cssu::Reference < cssxc::sax::XReferenceResolvedBroadcaster >
- xReferenceResolvedBroadcaster( m_xSAXEventKeeper, cssu::UNO_QUERY );
-
- xReferenceResolvedBroadcaster->removeReferenceResolvedListener(
- m_nIdOfTemplateEC,
- (const cssu::Reference < cssxc::sax::XReferenceResolvedListener >)((SecurityEngine *)this));
-
- m_xSAXEventKeeper->removeElementCollector(m_nIdOfTemplateEC);
-
- if (m_nIdOfBlocker != -1)
- {
- m_xSAXEventKeeper->removeBlocker(m_nIdOfBlocker);
- }
-
- if (m_nIdOfKeyEC != 0 && m_nIdOfKeyEC != -1)
- {
- m_xSAXEventKeeper->removeElementCollector(m_nIdOfKeyEC);
- }
-}
-
-/* XBlockerMonitor */
-void SAL_CALL EncryptionEngine::setBlockerId( sal_Int32 id )
- throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException)
-{
- m_nIdOfBlocker = id;
- tryToPerform();
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmlsecurity/source/framework/encryptionengine.hxx b/xmlsecurity/source/framework/encryptionengine.hxx
deleted file mode 100644
index 83522bb85..000000000
--- a/xmlsecurity/source/framework/encryptionengine.hxx
+++ /dev/null
@@ -1,102 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * 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
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _ENCRYPTIONENGINE_HXX
-#define _ENCRYPTIONENGINE_HXX
-
-#include <com/sun/star/xml/crypto/sax/XReferenceResolvedListener.hpp>
-#include <com/sun/star/xml/crypto/sax/XReferenceResolvedBroadcaster.hpp>
-#include <com/sun/star/xml/crypto/sax/XBlockerMonitor.hpp>
-#include <com/sun/star/xml/crypto/sax/XKeyCollector.hpp>
-#include <com/sun/star/xml/crypto/sax/XMissionTaker.hpp>
-#include <com/sun/star/xml/crypto/sax/XSAXEventKeeper.hpp>
-#include <com/sun/star/xml/crypto/XXMLSecurityContext.hpp>
-#include <com/sun/star/xml/crypto/XXMLEncryption.hpp>
-#include <cppuhelper/implbase1.hxx>
-
-#include "securityengine.hxx"
-
-class EncryptionEngine : public cppu::ImplInheritanceHelper1
-<
- SecurityEngine,
- com::sun::star::xml::crypto::sax::XBlockerMonitor
->
-/****** encryptionEngine.hxx/CLASS encryptionEngine ***************************
- *
- * NAME
- * EncryptionEngine -- Base class of Encryptor and Decryptor
- *
- * FUNCTION
- * Maintains common members and methods related with encryption.
- *
- * AUTHOR
- * Michael Mi
- * Email: michael.mi@sun.com
- ******************************************************************************/
-{
-protected:
- /*
- * the Encryption bridge component, which performs encrypt and decrypt
- * operation based on xmlsec library.
- */
- com::sun::star::uno::Reference<
- com::sun::star::xml::crypto::XXMLEncryption > m_xXMLEncryption;
-
- /*
- * the Id of template blocker.
- */
- sal_Int32 m_nIdOfBlocker;
-
-protected:
- EncryptionEngine( );
- virtual ~EncryptionEngine(){};
-
- virtual void tryToPerform( )
- throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException);
- virtual void clearUp( ) const;
- virtual bool checkReady() const;
-
- /*
- * starts the main function. This method will be implemented by any sub-class.
- * For a Encryptor, it performs encryption operation;
- * for a Decryptor, decryption operation is performed.
- */
- virtual void startEngine( const com::sun::star::uno::Reference<
- com::sun::star::xml::crypto::XXMLEncryptionTemplate >&)
- throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException)
- {};
-
-public:
- /* XBlockerMonitor */
- virtual void SAL_CALL setBlockerId( sal_Int32 id )
- throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException);
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmlsecurity/source/framework/encryptorimpl.cxx b/xmlsecurity/source/framework/encryptorimpl.cxx
deleted file mode 100644
index 1f2e32320..000000000
--- a/xmlsecurity/source/framework/encryptorimpl.cxx
+++ /dev/null
@@ -1,274 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * 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
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_xmlsecurity.hxx"
-
-#include "encryptorimpl.hxx"
-#include <com/sun/star/xml/crypto/XXMLEncryptionTemplate.hpp>
-#include <com/sun/star/xml/wrapper/XXMLElementWrapper.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-
-namespace cssu = com::sun::star::uno;
-namespace cssl = com::sun::star::lang;
-namespace cssxc = com::sun::star::xml::crypto;
-namespace cssxw = com::sun::star::xml::wrapper;
-
-#define SERVICE_NAME "com.sun.star.xml.crypto.sax.Encryptor"
-#define IMPLEMENTATION_NAME "com.sun.star.xml.security.framework.EncryptorImpl"
-
-#define DECLARE_ASCII( SASCIIVALUE ) \
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SASCIIVALUE ) )
-
-EncryptorImpl::EncryptorImpl( const cssu::Reference< cssl::XMultiServiceFactory >& rxMSF)
-{
- m_nReferenceId = -1;
- mxMSF = rxMSF;
-}
-
-EncryptorImpl::~EncryptorImpl()
-{
-}
-
-bool EncryptorImpl::checkReady() const
-/****** EncryptorImpl/checkReady *********************************************
- *
- * NAME
- * checkReady -- checks the conditions for the encryption.
- *
- * SYNOPSIS
- * bReady = checkReady( );
- *
- * FUNCTION
- * checks whether all following conditions are satisfied:
- * 1. the result listener is ready;
- * 2. the EncryptionEngine is ready.
- *
- * INPUTS
- * empty
- *
- * RESULT
- * bReady - true if all conditions are satisfied, false otherwise
- *
- * AUTHOR
- * Michael Mi
- * Email: michael.mi@sun.com
- ******************************************************************************/
-{
- sal_Int32 nKeyInc = 0;
- if (m_nIdOfKeyEC != 0)
- {
- nKeyInc = 1;
- }
-
- return (m_xResultListener.is() &&
- (m_nReferenceId != -1) &&
- (2+nKeyInc == m_nNumOfResolvedReferences) &&
- EncryptionEngine::checkReady());
-}
-
-void EncryptorImpl::notifyResultListener() const
- throw (cssu::Exception, cssu::RuntimeException)
-/****** DecryptorImpl/notifyResultListener ***********************************
- *
- * NAME
- * notifyResultListener -- notifies the listener about the encryption
- * result.
- *
- * SYNOPSIS
- * notifyResultListener( );
- *
- * FUNCTION
- * see NAME.
- *
- * INPUTS
- * empty
- *
- * RESULT
- * empty
- *
- * AUTHOR
- * Michael Mi
- * Email: michael.mi@sun.com
- ******************************************************************************/
-{
- cssu::Reference< cssxc::sax::XEncryptionResultListener >
- xEncryptionResultListener ( m_xResultListener , cssu::UNO_QUERY ) ;
-
- xEncryptionResultListener->encrypted( m_nSecurityId, m_nStatus );
-}
-
-void EncryptorImpl::startEngine( const cssu::Reference<
- cssxc::XXMLEncryptionTemplate >&
- xEncryptionTemplate)
- throw (cssu::Exception, cssu::RuntimeException)
-/****** EncryptorImpl/startEngine ********************************************
- *
- * NAME
- * startEngine -- generates the encryption.
- *
- * SYNOPSIS
- * startEngine( xEncryptionTemplate );
- *
- * FUNCTION
- * generates the encryption element, then if succeeds, updates the link
- * of old template element to the new encryption element in
- * SAXEventKeeper.
- *
- * INPUTS
- * xEncryptionTemplate - the encryption template to be encrypted.
- *
- * RESULT
- * empty
- *
- * AUTHOR
- * Michael Mi
- * Email: michael.mi@sun.com
- ******************************************************************************/
-{
- cssu::Reference < cssxc::XXMLEncryptionTemplate > xResultTemplate;
-
- cssu::Reference< cssxw::XXMLElementWrapper >
- xXMLElement = m_xSAXEventKeeper->getElement( m_nReferenceId );
- xEncryptionTemplate->setTarget(xXMLElement);
-
- try
- {
- xResultTemplate = m_xXMLEncryption->encrypt(
- xEncryptionTemplate, m_xSecurityEnvironment);
- m_nStatus = xResultTemplate->getStatus();
- }
- catch( cssu::Exception& )
- {
- m_nStatus = cssxc::SecurityOperationStatus_RUNTIMEERROR_FAILED;
- }
-
- if (m_nStatus == cssxc::SecurityOperationStatus_OPERATION_SUCCEEDED)
- {
- cssu::Reference < cssxw::XXMLElementWrapper > xResultEncryption
- = xResultTemplate->getTemplate();
- m_xSAXEventKeeper->setElement(m_nIdOfTemplateEC, xResultEncryption);
- m_xSAXEventKeeper->setElement(m_nReferenceId, NULL);
- }
-}
-
-/* XReferenceCollector */
-void SAL_CALL EncryptorImpl::setReferenceCount(sal_Int32)
- throw (cssu::Exception, cssu::RuntimeException)
-{
- /*
- * dummp method, because there is only one reference in
- * encryption, different from signature.
- * so the referenceNumber is always 1
- */
-}
-
-void SAL_CALL EncryptorImpl::setReferenceId( sal_Int32 id )
- throw (cssu::Exception, cssu::RuntimeException)
-{
- m_nReferenceId = id;
-}
-
-/* XEncryptionResultBroadcaster */
-void SAL_CALL EncryptorImpl::addEncryptionResultListener( const cssu::Reference< cssxc::sax::XEncryptionResultListener >& listener )
- throw (cssu::Exception, cssu::RuntimeException)
-{
- m_xResultListener = listener;
- tryToPerform();
-}
-
-void SAL_CALL EncryptorImpl::removeEncryptionResultListener( const cssu::Reference< cssxc::sax::XEncryptionResultListener >&)
- throw (cssu::RuntimeException)
-{
-}
-
-/* XInitialization */
-void SAL_CALL EncryptorImpl::initialize( const cssu::Sequence< cssu::Any >& aArguments )
- throw (cssu::Exception, cssu::RuntimeException)
-{
- OSL_ASSERT(aArguments.getLength() == 5);
-
- rtl::OUString ouTempString;
-
- aArguments[0] >>= ouTempString;
- m_nSecurityId = ouTempString.toInt32();
- aArguments[1] >>= m_xSAXEventKeeper;
- aArguments[2] >>= ouTempString;
- m_nIdOfTemplateEC = ouTempString.toInt32();
- aArguments[3] >>= m_xSecurityEnvironment;
- aArguments[4] >>= m_xXMLEncryption;
-}
-
-
-rtl::OUString EncryptorImpl_getImplementationName ()
- throw (cssu::RuntimeException)
-{
- return rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( IMPLEMENTATION_NAME ) );
-}
-
-sal_Bool SAL_CALL EncryptorImpl_supportsService( const rtl::OUString& ServiceName )
- throw (cssu::RuntimeException)
-{
- return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( SERVICE_NAME ));
-}
-
-cssu::Sequence< rtl::OUString > SAL_CALL EncryptorImpl_getSupportedServiceNames( )
- throw (cssu::RuntimeException)
-{
- cssu::Sequence < rtl::OUString > aRet(1);
- rtl::OUString* pArray = aRet.getArray();
- pArray[0] = rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME ) );
- return aRet;
-}
-#undef SERVICE_NAME
-
-cssu::Reference< cssu::XInterface > SAL_CALL EncryptorImpl_createInstance(
- const cssu::Reference< cssl::XMultiServiceFactory >& rSMgr)
- throw( cssu::Exception )
-{
- return (cppu::OWeakObject*) new EncryptorImpl(rSMgr);
-}
-
-/* XServiceInfo */
-rtl::OUString SAL_CALL EncryptorImpl::getImplementationName( )
- throw (cssu::RuntimeException)
-{
- return EncryptorImpl_getImplementationName();
-}
-sal_Bool SAL_CALL EncryptorImpl::supportsService( const rtl::OUString& rServiceName )
- throw (cssu::RuntimeException)
-{
- return EncryptorImpl_supportsService( rServiceName );
-}
-cssu::Sequence< rtl::OUString > SAL_CALL EncryptorImpl::getSupportedServiceNames( )
- throw (cssu::RuntimeException)
-{
- return EncryptorImpl_getSupportedServiceNames();
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmlsecurity/source/framework/encryptorimpl.hxx b/xmlsecurity/source/framework/encryptorimpl.hxx
deleted file mode 100644
index 905844f2f..000000000
--- a/xmlsecurity/source/framework/encryptorimpl.hxx
+++ /dev/null
@@ -1,147 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * 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
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _ENCRYPTORIMPL_HXX
-#define _ENCRYPTORIMPL_HXX
-
-#include <com/sun/star/xml/crypto/sax/XEncryptionResultBroadcaster.hpp>
-#include <com/sun/star/xml/crypto/sax/XEncryptionResultListener.hpp>
-#include <com/sun/star/xml/crypto/sax/XReferenceCollector.hpp>
-#include <com/sun/star/xml/crypto/XSecurityEnvironment.hpp>
-#include <com/sun/star/lang/XInitialization.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <cppuhelper/implbase4.hxx>
-
-#include "encryptionengine.hxx"
-
-class EncryptorImpl : public cppu::ImplInheritanceHelper4
-<
- EncryptionEngine,
- com::sun::star::xml::crypto::sax::XEncryptionResultBroadcaster,
- com::sun::star::xml::crypto::sax::XReferenceCollector,
- com::sun::star::lang::XInitialization,
- com::sun::star::lang::XServiceInfo
->
-/****** EncryptorImpl.hxx/CLASS EncryptorImpl *********************************
- *
- * NAME
- * EncryptorImpl -- generates an encryption
- *
- * FUNCTION
- * Collects all resources for an encryption generation, then generates the
- * encryption by invoking a xmlsec-based encryption bridge component.
- *
- * AUTHOR
- * Michael Mi
- * Email: michael.mi@sun.com
- ******************************************************************************/
-{
-private:
- /*
- * the Id of the encryption, which is used for the result listener to
- * identify the encryption.
- */
- sal_Int32 m_nEncryptionId;
-
- /*
- * the Id of the element to be encrypted.
- */
- sal_Int32 m_nReferenceId;
-
- /*
- * the decryption result,
- * remembers whether the encryption succeeds.
- */
- bool m_bEncryptionSucceed;
-
- com::sun::star::uno::Reference<
- com::sun::star::xml::crypto::XSecurityEnvironment > m_xSecurityEnvironment;
-
- virtual void notifyResultListener() const
- throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException);
- virtual bool checkReady() const;
- virtual void startEngine( const com::sun::star::uno::Reference<
- com::sun::star::xml::crypto::XXMLEncryptionTemplate >&
- xEncryptionTemplate)
- throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException);
-
-public:
- explicit EncryptorImpl( const com::sun::star::uno::Reference<
- com::sun::star::lang::XMultiServiceFactory >& rxMSF);
- virtual ~EncryptorImpl();
-
- /* XEncryptionResultBroadcaster */
- virtual void SAL_CALL addEncryptionResultListener(
- const com::sun::star::uno::Reference<
- com::sun::star::xml::crypto::sax::XEncryptionResultListener >&
- listener )
- throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeEncryptionResultListener(
- const com::sun::star::uno::Reference<
- com::sun::star::xml::crypto::sax::XEncryptionResultListener >&
- listener )
- throw (com::sun::star::uno::RuntimeException);
-
- /* XReferenceCollector */
- virtual void SAL_CALL setReferenceCount( sal_Int32 count )
- throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException);
-
- virtual void SAL_CALL setReferenceId( sal_Int32 id )
- throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException);
-
- /* XInitialization */
- virtual void SAL_CALL initialize(
- const com::sun::star::uno::Sequence< com::sun::star::uno::Any >& aArguments )
- throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException);
-
- /* XServiceInfo */
- virtual rtl::OUString SAL_CALL getImplementationName( )
- throw (com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsService( const rtl::OUString& ServiceName )
- throw (com::sun::star::uno::RuntimeException);
- virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames( )
- throw (com::sun::star::uno::RuntimeException);
-};
-
-rtl::OUString EncryptorImpl_getImplementationName()
- throw ( com::sun::star::uno::RuntimeException );
-
-sal_Bool SAL_CALL EncryptorImpl_supportsService( const rtl::OUString& ServiceName )
- throw ( com::sun::star::uno::RuntimeException );
-
-com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL EncryptorImpl_getSupportedServiceNames( )
- throw ( com::sun::star::uno::RuntimeException );
-
-com::sun::star::uno::Reference< com::sun::star::uno::XInterface >
-SAL_CALL EncryptorImpl_createInstance(
- const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >& rSMgr)
- throw ( com::sun::star::uno::Exception );
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmlsecurity/source/framework/makefile.mk b/xmlsecurity/source/framework/makefile.mk
deleted file mode 100644
index 54c1fb507..000000000
--- a/xmlsecurity/source/framework/makefile.mk
+++ /dev/null
@@ -1,61 +0,0 @@
-#*************************************************************************
-#
-# 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
-#
-# This file is part of OpenOffice.org.
-#
-# OpenOffice.org is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License version 3
-# only, as published by the Free Software Foundation.
-#
-# OpenOffice.org is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License version 3 for more details
-# (a copy is included in the LICENSE file that accompanied this code).
-#
-# You should have received a copy of the GNU Lesser General Public License
-# version 3 along with OpenOffice.org. If not, see
-# <http://www.openoffice.org/license.html>
-# for a copy of the LGPLv3 License.
-#
-#*************************************************************************
-
-PRJ=..$/..
-
-PRJNAME = xmlsecurity
-TARGET = fw
-
-ENABLE_EXCEPTIONS = TRUE
-
-# --- Settings -----------------------------------------------------
-
-.INCLUDE : settings.mk
-.INCLUDE : $(PRJ)$/util$/target.pmk
-
-
-# --- Files --------------------------------------------------------
-SLOFILES= \
- $(SLO)$/buffernode.obj \
- $(SLO)$/elementcollector.obj \
- $(SLO)$/elementmark.obj \
- $(SLO)$/securityengine.obj \
- $(SLO)$/signatureengine.obj \
- $(SLO)$/encryptionengine.obj \
- $(SLO)$/signaturecreatorimpl.obj \
- $(SLO)$/signatureverifierimpl.obj \
- $(SLO)$/encryptorimpl.obj \
- $(SLO)$/decryptorimpl.obj \
- $(SLO)$/saxeventkeeperimpl.obj \
- $(SLO)$/xmlencryptiontemplateimpl.obj \
- $(SLO)$/xmlsignaturetemplateimpl.obj \
- $(SLO)$/xsec_framework.obj
-
-# --- Targets ------------------------------------------------------
-
-.INCLUDE : target.mk
-
diff --git a/xmlsecurity/source/framework/saxeventkeeperimpl.cxx b/xmlsecurity/source/framework/saxeventkeeperimpl.cxx
deleted file mode 100644
index 076128eb1..000000000
--- a/xmlsecurity/source/framework/saxeventkeeperimpl.cxx
+++ /dev/null
@@ -1,1426 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * 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
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_xmlsecurity.hxx"
-
-#include "saxeventkeeperimpl.hxx"
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
-#include <com/sun/star/xml/crypto/sax/ConstOfSecurityId.hpp>
-
-namespace cssu = com::sun::star::uno;
-namespace cssl = com::sun::star::lang;
-namespace cssxc = com::sun::star::xml::crypto;
-namespace cssxcsax = com::sun::star::xml::csax;
-namespace cssxw = com::sun::star::xml::wrapper;
-namespace cssxs = com::sun::star::xml::sax;
-
-#define SERVICE_NAME "com.sun.star.xml.crypto.sax.SAXEventKeeper"
-#define IMPLEMENTATION_NAME "com.sun.star.xml.security.framework.SAXEventKeeperImpl"
-
-#define _USECOMPRESSEDDOCUMENTHANDLER
-
-SAXEventKeeperImpl::SAXEventKeeperImpl( )
- :m_pRootBufferNode(NULL),
- m_pCurrentBufferNode(NULL),
- m_nNextElementMarkId(1),
- m_pNewBlocker(NULL),
- m_pCurrentBlockingBufferNode(NULL),
- m_bIsReleasing(false),
- m_bIsForwarding(false)
-{
- m_vElementMarkBuffers.reserve(2);
- m_vNewElementCollectors.reserve(2);
- m_vReleasedElementMarkBuffers.reserve(2);
-}
-
-SAXEventKeeperImpl::~SAXEventKeeperImpl()
-{
- /*
- * delete the BufferNode tree
- */
- if (m_pRootBufferNode != NULL)
- {
- m_pRootBufferNode->freeAllChildren();
- delete m_pRootBufferNode;
- }
-
- m_pRootBufferNode = m_pCurrentBufferNode = m_pCurrentBlockingBufferNode = NULL;
-
- /*
- * delete all unfreed ElementMarks
- */
- m_vNewElementCollectors.clear();
- m_pNewBlocker = NULL;
-
- std::vector< const ElementMark* >::const_iterator ii = m_vElementMarkBuffers.begin();
- for( ; ii != m_vElementMarkBuffers.end(); ++ii )
- {
- delete (*ii);
- }
- m_vElementMarkBuffers.clear();
-}
-
-void SAXEventKeeperImpl::setCurrentBufferNode(BufferNode* pBufferNode)
-/****** SAXEventKeeperImpl/setCurrentBufferNode ******************************
- *
- * NAME
- * setCurrentBufferNode -- set a new active BufferNode.
- *
- * SYNOPSIS
- * setCurrentBufferNode( pBufferNode );
- *
- * FUNCTION
- * connects this BufferNode into the BufferNode tree as a child of the
- * current active BufferNode. Then makes this BufferNode as the current
- * active BufferNode.
- * If the previous active BufferNode points to the root
- * BufferNode, which means that no buffering operation was proceeding,
- * then notifies the status change listener that buffering operation
- * will begin at once.
- *
- * INPUTS
- * pBufferNode - a BufferNode which will be the new active BufferNode
- *
- * RESULT
- * empty
- *
- * AUTHOR
- * Michael Mi
- * Email: michael.mi@sun.com
- ******************************************************************************/
-{
- if (pBufferNode != m_pCurrentBufferNode)
- {
- if ( m_pCurrentBufferNode == m_pRootBufferNode &&
- m_xSAXEventKeeperStatusChangeListener.is())
- {
- m_xSAXEventKeeperStatusChangeListener->collectionStatusChanged(sal_True);
- }
-
- if (pBufferNode->getParent() == NULL)
- {
- m_pCurrentBufferNode->addChild(pBufferNode);
- pBufferNode->setParent(m_pCurrentBufferNode);
- }
-
- m_pCurrentBufferNode = pBufferNode;
- }
-}
-
-BufferNode* SAXEventKeeperImpl::addNewElementMarkBuffers()
-/****** SAXEventKeeperImpl/addNewElementMarkBuffers **************************
- *
- * NAME
- * addNewElementMarkBuffers -- add new ElementCollectors and new Blocker.
- *
- * SYNOPSIS
- * pBufferNode = addNewElementMarkBuffers( );
- *
- * FUNCTION
- * if there are new ElementCollector or new Blocker to be added, then
- * connect all of them with the current BufferNode. In case of the
- * current BufferNode doesn't exist, creates one.
- * Clears up the new ElementCollector list and the new Blocker pointer.
- *
- * INPUTS
- * empty
- *
- * RESULT
- * pBufferNode - the BufferNode that has been connected with both new
- * ElementCollectors and new Blocker.
- *
- * AUTHOR
- * Michael Mi
- * Email: michael.mi@sun.com
- ******************************************************************************/
-{
- BufferNode* pBufferNode = NULL;
-
- if ( (!m_vNewElementCollectors.empty()) ||
- (m_pNewBlocker != NULL))
- {
- /*
- * When the current BufferNode is right pointing to the current
- * working element in the XMLDocumentWrapper component, then
- * no new BufferNode is needed to create.
- * This situation can only happen in the "Forwarding" mode.
- */
- if ( (m_pCurrentBufferNode != NULL) &&
- (m_xXMLDocument->isCurrent(m_pCurrentBufferNode->getXMLElement())))
- {
- pBufferNode = m_pCurrentBufferNode;
- }
- else
- {
- pBufferNode = new BufferNode(m_xXMLDocument->getCurrentElement());
- }
-
- if (m_pNewBlocker != NULL)
- {
- pBufferNode->setBlocker(m_pNewBlocker);
-
- /*
- * If no blocking before, then notify the status change listener that
- * the SAXEventKeeper has entered "blocking" status, during which, no
- * SAX events will be forwarded to the next document handler.
- */
- if (m_pCurrentBlockingBufferNode == NULL)
- {
- m_pCurrentBlockingBufferNode = pBufferNode;
-
- if (m_xSAXEventKeeperStatusChangeListener.is())
- {
- m_xSAXEventKeeperStatusChangeListener->blockingStatusChanged(sal_True);
- }
- }
-
- m_pNewBlocker = NULL;
- }
-
- if (!m_vNewElementCollectors.empty())
- {
- std::vector< const ElementCollector* >::const_iterator ii = m_vNewElementCollectors.begin();
-
- for( ; ii != m_vNewElementCollectors.end(); ++ii )
- {
- pBufferNode->addElementCollector(*ii);
- }
-
- m_vNewElementCollectors.clear();
- }
- }
-
- return pBufferNode;
-}
-
-ElementMark* SAXEventKeeperImpl::findElementMarkBuffer(sal_Int32 nId) const
-/****** SAXEventKeeperImpl/findElementMarkBuffer *****************************
- *
- * NAME
- * findElementMarkBuffer -- finds an ElementMark.
- *
- * SYNOPSIS
- * pElementMark = findElementMarkBuffer( nId );
- *
- * FUNCTION
- * searches an ElementMark with the particular Id in the ElementMark
- * list.
- *
- * INPUTS
- * nId - the Id of the ElementMark to be searched.
- *
- * RESULT
- * pElementMark - the ElementMark with the particular Id, or NULL when
- * no such Id exists.
- *
- * AUTHOR
- * Michael Mi
- * Email: michael.mi@sun.com
- ******************************************************************************/
-{
- ElementMark* pElementMark = NULL;
-
- std::vector< const ElementMark* >::const_iterator ii = m_vElementMarkBuffers.begin();
-
- for( ; ii != m_vElementMarkBuffers.end(); ++ii )
- {
- if ( nId == (*ii)->getBufferId())
- {
- pElementMark = (ElementMark*)*ii;
- break;
- }
- }
-
- return pElementMark;
-}
-
-void SAXEventKeeperImpl::removeElementMarkBuffer(sal_Int32 nId)
-/****** SAXEventKeeperImpl/removeElementMarkBuffer ***************************
- *
- * NAME
- * removeElementMarkBuffer -- removes an ElementMark
- *
- * SYNOPSIS
- * removeElementMarkBuffer( nId );
- *
- * FUNCTION
- * removes an ElementMark with the particular Id in the ElementMark list.
- *
- * INPUTS
- * nId - the Id of the ElementMark to be removed.
- *
- * RESULT
- * empty
- *
- * AUTHOR
- * Michael Mi
- * Email: michael.mi@sun.com
- ******************************************************************************/
-{
- std::vector< const ElementMark* >::iterator ii = m_vElementMarkBuffers.begin();
-
- for( ; ii != m_vElementMarkBuffers.end(); ++ii )
- {
- if ( nId == (*ii)->getBufferId())
- {
- /*
- * checks whether this ElementMark still in the new ElementCollect array
- */
- std::vector< const ElementCollector* >::iterator jj = m_vNewElementCollectors.begin();
- for( ; jj != m_vNewElementCollectors.end(); ++jj )
- {
- if ((*ii) == (*jj))
- {
- m_vNewElementCollectors.erase(jj);
- break;
- }
- }
-
- /*
- * checks whether this ElementMark is the new Blocker
- */
- if ((*ii) == m_pNewBlocker)
- {
- m_pNewBlocker = NULL;
- }
-
- /*
- * destory the ElementMark
- */
- delete (*ii);
-
- m_vElementMarkBuffers.erase( ii );
- break;
- }
- }
-}
-
-rtl::OUString SAXEventKeeperImpl::printBufferNode(
- BufferNode* pBufferNode, sal_Int32 nIndent) const
-/****** SAXEventKeeperImpl/printBufferNode ***********************************
- *
- * NAME
- * printBufferNode -- retrieves the information of a BufferNode and its
- * branch.
- *
- * SYNOPSIS
- * info = printBufferNode( pBufferNode, nIndent );
- *
- * FUNCTION
- * all retrieved information includes:
- * 1. whether it is the current BufferNode;
- * 2. whether it is the current blocking BufferNode;
- * 3. the name of the parent element;
- * 4. the name of this element;
- * 5. all ElementCollectors working on this BufferNode;
- * 6. the Blocker working on this BufferNode;
- * 7. all child BufferNodes' information.
- *
- * INPUTS
- * pBufferNode - the BufferNode from where information will be retrieved.
- * nIndent - how many space characters prefixed before the output
- * message.
- *
- * RESULT
- * info - the information string
- *
- * AUTHOR
- * Michael Mi
- * Email: michael.mi@sun.com
- ******************************************************************************/
-{
- rtl::OUString rc;
-
- for ( int i=0; i<nIndent; ++i )
- {
- rc += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( " " ));
- }
-
- if (pBufferNode == m_pCurrentBufferNode)
- {
- rc += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "[%]" ));
- }
-
- if (pBufferNode == m_pCurrentBlockingBufferNode)
- {
- rc += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "[B]" ));
- }
-
- rc += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( " " ));
- rc += m_xXMLDocument->getNodeName(pBufferNode->getXMLElement());
-
- BufferNode* pParent = (BufferNode*)pBufferNode->getParent();
- if (pParent != NULL)
- {
- rc += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "[" ));
- rc += m_xXMLDocument->getNodeName(pParent->getXMLElement());
- rc += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "]" ));
- }
-
- rc += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ":EC=" ));
- rc += pBufferNode->printChildren();
- rc += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( " BR=" ));
-
- ElementMark * pBlocker = pBufferNode->getBlocker();
- if (pBlocker != NULL)
- {
- rc += rtl::OUString::valueOf( pBlocker->getBufferId() );
- rc += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "(SecId=" ));
- rc += rtl::OUString::valueOf( pBlocker->getSecurityId() );
- rc += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ")" ));
- rc += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( " " ));
- }
- rc += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "\n" ));
-
- std::vector< const BufferNode* >* vChildren = pBufferNode->getChildren();
- std::vector< const BufferNode* >::const_iterator jj = vChildren->begin();
- for( ; jj != vChildren->end(); ++jj )
- {
- rc += printBufferNode((BufferNode *)*jj, nIndent+4);
- }
-
- delete vChildren;
-
- return rc;
-}
-
-cssu::Sequence< cssu::Reference< cssxw::XXMLElementWrapper > >
- SAXEventKeeperImpl::collectChildWorkingElement(BufferNode* pBufferNode) const
-/****** SAXEventKeeperImpl/collectChildWorkingElement ************************
- *
- * NAME
- * collectChildWorkingElement -- collects a BufferNode's all child
- * Elements.
- *
- * SYNOPSIS
- * list = collectChildWorkingElement( pBufferNode );
- *
- * FUNCTION
- * see NAME.
- *
- * INPUTS
- * pBufferNode - the BufferNode whose child Elements will be collected.
- *
- * RESULT
- * list - the child Elements list.
- *
- * AUTHOR
- * Michael Mi
- * Email: michael.mi@sun.com
- ******************************************************************************/
-{
- std::vector< const BufferNode* >* vChildren = pBufferNode->getChildren();
-
- cssu::Sequence < cssu::Reference<
- cssxw::XXMLElementWrapper > > aChildrenCollection ( vChildren->size());
-
- std::vector< const BufferNode* >::const_iterator ii = vChildren->begin();
-
- sal_Int32 nIndex = 0;
- for( ; ii != vChildren->end(); ++ii )
- {
- aChildrenCollection[nIndex] = (*ii)->getXMLElement();
- nIndex++;
- }
-
- delete vChildren;
-
- return aChildrenCollection;
-}
-
-void SAXEventKeeperImpl::smashBufferNode(
- BufferNode* pBufferNode, bool bClearRoot) const
-/****** SAXEventKeeperImpl/smashBufferNode ***********************************
- *
- * NAME
- * smashBufferNode -- removes a BufferNode along with its working
- * element.
- *
- * SYNOPSIS
- * smashBufferNode( pBufferNode, bClearRoot );
- *
- * FUNCTION
- * removes the BufferNode's working element from the DOM document, while
- * reserves all ancestor paths for its child BufferNodes.
- * when any of the BufferNode's ancestor element is useless, removes it
- * too.
- * removes the BufferNode from the BufferNode tree.
- *
- * INPUTS
- * pBufferNode - the BufferNode to be removed
- * bClearRoot - whether the root element also needs to be cleared up.
- *
- * RESULT
- * empty
- *
- * NOTES
- * when removeing a Blocker's BufferNode, the bClearRoot flag should be
- * true. Because a Blocker can buffer many SAX events which are not used
- * by any other ElementCollector or Blocker.
- * When the bClearRoot is set to true, the root BufferNode will be first
- * cleared, with a stop flag seting at the next Blocking BufferNode. This
- * operation can delete all useless bufferred SAX events which are only
- * needed by the Blocker to be deleted.
- *
- * AUTHOR
- * Michael Mi
- * Email: michael.mi@sun.com
- ******************************************************************************/
-{
- if (!pBufferNode->hasAnything())
- {
- BufferNode* pParent = (BufferNode*)pBufferNode->getParent();
-
- /*
- * delete the XML data
- */
- if (pParent == m_pRootBufferNode)
- {
- bool bIsNotBlocking = (m_pCurrentBlockingBufferNode == NULL);
- bool bIsBlockInside = false;
- bool bIsBlockingAfterward = false;
-
- /*
- * If this is a blocker, then remove any out-element data
- * which caused by blocking. The removal process will stop
- * at the next blokcer to avoid removing any useful data.
- */
- if (bClearRoot)
- {
- cssu::Sequence< cssu::Reference< cssxw::XXMLElementWrapper > >
- aChildElements = collectChildWorkingElement(m_pRootBufferNode);
-
- /*
- * the clearUselessData only clearup the content in the
- * node, not the node itself.
- */
- m_xXMLDocument->clearUselessData(m_pRootBufferNode->getXMLElement(),
- aChildElements,
- bIsNotBlocking?(NULL):
- (m_pCurrentBlockingBufferNode->getXMLElement()));
-
- /*
- * remove the node if it is empty, then if its parent is also
- * empty, remove it, then if the next parent is also empty,
- * remove it,..., until parent become null.
- */
- m_xXMLDocument->collapse( m_pRootBufferNode->getXMLElement() );
- }
-
- /*
- * if blocking, check the relationship between this BufferNode and
- * the current blocking BufferNode.
- */
- if ( !bIsNotBlocking )
- {
- /*
- * the current blocking BufferNode is a descendant of this BufferNode.
- */
- bIsBlockInside = (NULL != pBufferNode->isAncestor(m_pCurrentBlockingBufferNode));
-
- /*
- * the current blocking BufferNode locates behind this BufferNode in tree
- * order.
- */
- bIsBlockingAfterward = pBufferNode->isPrevious(m_pCurrentBlockingBufferNode);
- }
-
- /*
- * this BufferNode's working element needs to be deleted only when
- * 1. there is no blocking, or
- * 2. the current blocking BufferNode is a descendant of this BufferNode,
- * (then in the BufferNode's working element, the useless data before the blocking
- * element should be deleted.) or
- * 3. the current blocking BufferNode is locates behind this BufferNode in tree,
- * (then the useless data between the blocking element and the working element
- * should be deleted.).
- * Otherwise, this working element should not be deleted.
- */
- if ( bIsNotBlocking || bIsBlockInside || bIsBlockingAfterward )
- {
- cssu::Sequence< cssu::Reference< cssxw::XXMLElementWrapper > >
- aChildElements = collectChildWorkingElement(pBufferNode);
-
- /*
- * the clearUselessData only clearup the content in the
- * node, not the node itself.
- */
- m_xXMLDocument->clearUselessData(pBufferNode->getXMLElement(),
- aChildElements,
- bIsBlockInside?(m_pCurrentBlockingBufferNode->getXMLElement()):
- (NULL));
-
- /*
- * remove the node if it is empty, then if its parent is also
- * empty, remove it, then if the next parent is also empty,
- * remove it,..., until parent become null.
- */
- m_xXMLDocument->collapse( pBufferNode->getXMLElement() );
- }
- }
-
- sal_Int32 nIndex = pParent->indexOfChild(pBufferNode);
-
- std::vector< const BufferNode* >* vChildren = pBufferNode->getChildren();
- pParent->removeChild(pBufferNode);
- pBufferNode->setParent(NULL);
-
- std::vector< const BufferNode * >::const_iterator ii = vChildren->begin();
- for( ; ii != vChildren->end(); ++ii )
- {
- ((BufferNode *)(*ii))->setParent(pParent);
- pParent->addChild(*ii, nIndex);
- nIndex++;
- }
-
- delete vChildren;
-
- /*
- * delete the BufferNode
- */
- delete pBufferNode;
- }
-}
-
-BufferNode* SAXEventKeeperImpl::findNextBlockingBufferNode(
- BufferNode* pStartBufferNode) const
-/****** SAXEventKeeperImpl/findNextBlockingBufferNode ************************
- *
- * NAME
- * findNextBlockingBufferNode -- finds the next blocking BufferNode
- * behind the particular BufferNode.
- *
- * SYNOPSIS
- * pBufferNode = findNextBlockingBufferNode( pStartBufferNode );
- *
- * FUNCTION
- * see NAME.
- *
- * INPUTS
- * pStartBufferNode - the BufferNode from where to search the next
- * blocking BufferNode.
- *
- * RESULT
- * pBufferNode - the next blocking BufferNode, or NULL if no such
- * BufferNode exists.
- *
- * AUTHOR
- * Michael Mi
- * Email: michael.mi@sun.com
- ******************************************************************************/
-{
- BufferNode* pNext = NULL;
-
- if (pStartBufferNode != NULL)
- {
- pNext = pStartBufferNode;
-
- while (NULL != (pNext = (BufferNode*)pNext->getNextNodeByTreeOrder()))
- {
- if (pNext->getBlocker() != NULL)
- {
- break;
- }
- }
- }
-
- return pNext;
-}
-
-void SAXEventKeeperImpl::diffuse(BufferNode* pBufferNode) const
-/****** SAXEventKeeperImpl/diffuse *******************************************
- *
- * NAME
- * diffuse -- diffuse the notification.
- *
- * SYNOPSIS
- * diffuse( pBufferNode );
- *
- * FUNCTION
- * diffuse the collecting completion notification from the specific
- * BufferNode along its parent link, until an ancestor which is not
- * completely received is met.
- *
- * INPUTS
- * pBufferNode - the BufferNode from which the notification will be
- * diffused.
- *
- * RESULT
- * empty
- *
- * AUTHOR
- * Michael Mi
- * Email: michael.mi@sun.com
- ******************************************************************************/
-{
- BufferNode* pParent = pBufferNode;
-
- while(pParent->isAllReceived())
- {
- pParent->elementCollectorNotify();
- pParent = (BufferNode*)pParent->getParent();
- }
-}
-
-void SAXEventKeeperImpl::releaseElementMarkBuffer()
-/****** SAXEventKeeperImpl/releaseElementMarkBuffer **************************
- *
- * NAME
- * releaseElementMarkBuffer -- releases useless ElementMarks
- *
- * SYNOPSIS
- * releaseElementMarkBuffer( );
- *
- * FUNCTION
- * releases each ElementMark in the releasing list
- * m_vReleasedElementMarkBuffers.
- * The operation differs between an ElementCollector and a Blocker.
- *
- * INPUTS
- * empty
- *
- * RESULT
- * empty
- *
- * AUTHOR
- * Michael Mi
- * Email: michael.mi@sun.com
- ******************************************************************************/
-{
- m_bIsReleasing = true;
- while (!m_vReleasedElementMarkBuffers.empty())
- {
- std::vector< sal_Int32 >::iterator pId = m_vReleasedElementMarkBuffers.begin();
- sal_Int32 nId = *pId;
- m_vReleasedElementMarkBuffers.erase( pId );
-
- ElementMark* pElementMark = findElementMarkBuffer(nId);
-
- if (pElementMark != NULL)
- {
- if (cssxc::sax::ElementMarkType_ELEMENTCOLLECTOR
- == pElementMark->getType())
- /*
- * it is a EC
- */
- {
- ElementCollector* pElementCollector = (ElementCollector*)pElementMark;
-
- cssxc::sax::ElementMarkPriority nPriority = pElementCollector->getPriority();
- bool bToModify = pElementCollector->getModify();
-
- /*
- * Delete the EC from the buffer node.
- */
- BufferNode* pBufferNode = pElementCollector->getBufferNode();
- pBufferNode->removeElementCollector(pElementCollector);
-
- if ( nPriority == cssxc::sax::ElementMarkPriority_BEFOREMODIFY)
- {
- pBufferNode->notifyBranch();
- }
-
- if (bToModify)
- {
- pBufferNode->notifyAncestor();
- }
-
- /*
- * delete the ElementMark
- */
- pElementCollector = NULL;
- pElementMark = NULL;
- removeElementMarkBuffer(nId);
-
- /*
- * delete the BufferNode
- */
- diffuse(pBufferNode);
- smashBufferNode(pBufferNode, false);
- }
- else
- /*
- * it is a Blocker
- */
- {
- /*
- * Delete the TH from the buffer node.
- */
- BufferNode *pBufferNode = pElementMark->getBufferNode();
- pBufferNode->setBlocker(NULL);
-
- /*
- * If there is a following handler and no blocking now, then
- * forward this event
- */
- if (m_pCurrentBlockingBufferNode == pBufferNode)
- {
- /*
- * Before forwarding, the next blocking point needs to be
- * found.
- */
- m_pCurrentBlockingBufferNode = findNextBlockingBufferNode(pBufferNode);
-
- /*
- * Forward the blocked events between these two STHs.
- */
- if (m_xNextHandler.is())
- {
- BufferNode* pTempCurrentBufferNode = m_pCurrentBufferNode;
- BufferNode* pTempCurrentBlockingBufferNode = m_pCurrentBlockingBufferNode;
-
- m_pCurrentBufferNode = pBufferNode;
- m_pCurrentBlockingBufferNode = NULL;
-
- m_bIsForwarding = true;
-
- m_xXMLDocument->generateSAXEvents(
- m_xNextHandler,
- this,
- pBufferNode->getXMLElement(),
- (pTempCurrentBlockingBufferNode == NULL)?NULL:(pTempCurrentBlockingBufferNode->getXMLElement()));
-
- m_bIsForwarding = false;
-
- m_pCurrentBufferNode = pTempCurrentBufferNode;
- if (m_pCurrentBlockingBufferNode == NULL)
- {
- m_pCurrentBlockingBufferNode = pTempCurrentBlockingBufferNode;
- }
- }
-
- if (m_pCurrentBlockingBufferNode == NULL &&
- m_xSAXEventKeeperStatusChangeListener.is())
- {
- m_xSAXEventKeeperStatusChangeListener->blockingStatusChanged(sal_False);
- }
- }
-
- /*
- * delete the ElementMark
- */
- pElementMark = NULL;
- removeElementMarkBuffer(nId);
-
- /*
- * delete the BufferNode
- */
- diffuse(pBufferNode);
- smashBufferNode(pBufferNode, true);
- }
- }
- }
-
- m_bIsReleasing = false;
-
- if (!m_pRootBufferNode->hasAnything() &&
- !m_pRootBufferNode->hasChildren() &&
- m_xSAXEventKeeperStatusChangeListener.is())
- {
- m_xSAXEventKeeperStatusChangeListener->bufferStatusChanged(sal_True);
- }
-}
-
-void SAXEventKeeperImpl::markElementMarkBuffer(sal_Int32 nId)
-/****** SAXEventKeeperImpl/markElementMarkBuffer *****************************
- *
- * NAME
- * markElementMarkBuffer -- marks an ElementMark to be released
- *
- * SYNOPSIS
- * markElementMarkBuffer( nId );
- *
- * FUNCTION
- * puts the ElementMark with the particular Id into the releasing list,
- * checks whether the releasing process is runing, if not then launch
- * this process.
- *
- * INPUTS
- * nId - the Id of the ElementMark which will be released
- *
- * RESULT
- * empty
- *
- * AUTHOR
- * Michael Mi
- * Email: michael.mi@sun.com
- ******************************************************************************/
-{
- m_vReleasedElementMarkBuffers.push_back( nId );
- if ( !m_bIsReleasing )
- {
- releaseElementMarkBuffer();
- }
-}
-
-sal_Int32 SAXEventKeeperImpl::createElementCollector(
- sal_Int32 nSecurityId,
- cssxc::sax::ElementMarkPriority nPriority,
- bool bModifyElement,
- const cssu::Reference< cssxc::sax::XReferenceResolvedListener >& xReferenceResolvedListener)
-/****** SAXEventKeeperImpl/createElementCollector ****************************
- *
- * NAME
- * createElementCollector -- creates a new ElementCollector on the
- * incoming element.
- *
- * SYNOPSIS
- * nId = createElementCollector( nSecurityId, nPriority,
- * bModifyElement,
- * xReferenceResolvedListener );
- *
- * FUNCTION
- * allocs a new Id, then create an ElementCollector with this Id value.
- * Add the new created ElementCollector to the new ElementCollecotor list.
- *
- * INPUTS
- * nSecurityId - the security Id of the new ElementCollector
- * nPriority - the prirority of the new ElementCollector
- * bModifyElement -whether this BufferNode will modify the content of
- * the corresponding element it works on
- * xReferenceResolvedListener - the listener for the new ElementCollector.
- *
- * RESULT
- * nId - the Id of the new ElementCollector
- *
- * AUTHOR
- * Michael Mi
- * Email: michael.mi@sun.com
- ******************************************************************************/
-{
- sal_Int32 nId = m_nNextElementMarkId;
- m_nNextElementMarkId ++;
-
- ElementCollector* pElementCollector
- = new ElementCollector(
- nSecurityId,
- nId,
- nPriority,
- bModifyElement,
- xReferenceResolvedListener);
-
- m_vElementMarkBuffers.push_back( pElementCollector );
-
- /*
- * All the new EC to initial EC array.
- */
- m_vNewElementCollectors.push_back( pElementCollector );
-
- return nId;
-}
-
-
-sal_Int32 SAXEventKeeperImpl::createBlocker(sal_Int32 nSecurityId)
-/****** SAXEventKeeperImpl/createBlocker *************************************
- *
- * NAME
- * createBlocker -- creates a new Blocker on the incoming element.
- *
- * SYNOPSIS
- * nId = createBlocker( nSecurityId );
- *
- * FUNCTION
- * see NAME.
- *
- * INPUTS
- * nSecurityId - the security Id of the new Blocker
- *
- * RESULT
- * nId - the Id of the new Blocker
- *
- * AUTHOR
- * Michael Mi
- * Email: michael.mi@sun.com
- ******************************************************************************/
-{
- sal_Int32 nId = m_nNextElementMarkId;
- m_nNextElementMarkId ++;
-
- OSL_ASSERT(m_pNewBlocker == NULL);
-
- m_pNewBlocker = new ElementMark(nSecurityId, nId);
- m_vElementMarkBuffers.push_back( m_pNewBlocker );
-
- return nId;
-}
-
-/* XSAXEventKeeper */
-sal_Int32 SAL_CALL SAXEventKeeperImpl::addElementCollector( )
- throw (cssu::RuntimeException)
-{
- return createElementCollector(
- cssxc::sax::ConstOfSecurityId::UNDEFINEDSECURITYID,
- cssxc::sax::ElementMarkPriority_AFTERMODIFY,
- false,
- NULL);
-}
-
-void SAL_CALL SAXEventKeeperImpl::removeElementCollector( sal_Int32 id )
- throw (cssu::RuntimeException)
-{
- markElementMarkBuffer(id);
-}
-
-sal_Int32 SAL_CALL SAXEventKeeperImpl::addBlocker( )
- throw (cssu::RuntimeException)
-{
- return createBlocker(cssxc::sax::ConstOfSecurityId::UNDEFINEDSECURITYID);
-}
-
-void SAL_CALL SAXEventKeeperImpl::removeBlocker( sal_Int32 id )
- throw (cssu::RuntimeException)
-{
- markElementMarkBuffer(id);
-}
-
-sal_Bool SAL_CALL SAXEventKeeperImpl::isBlocking( )
- throw (cssu::RuntimeException)
-{
- return (m_pCurrentBlockingBufferNode != NULL);
-}
-
-cssu::Reference< cssxw::XXMLElementWrapper > SAL_CALL
- SAXEventKeeperImpl::getElement( sal_Int32 id )
- throw (cssu::RuntimeException)
-{
- cssu::Reference< cssxw::XXMLElementWrapper > rc;
-
- ElementMark* pElementMark = findElementMarkBuffer(id);
- if (pElementMark != NULL)
- {
- rc = pElementMark->getBufferNode()->getXMLElement();
- }
-
- return rc;
-}
-
-void SAL_CALL SAXEventKeeperImpl::setElement(
- sal_Int32 id,
- const cssu::Reference< cssxw::XXMLElementWrapper >& aElement )
- throw (cssu::RuntimeException)
-{
- if (aElement.is())
- {
- m_xXMLDocument->rebuildIDLink(aElement);
-
- ElementMark* pElementMark = findElementMarkBuffer(id);
-
- if (pElementMark != NULL)
- {
- BufferNode* pBufferNode = pElementMark->getBufferNode();
- if (pBufferNode != NULL)
- {
- bool bIsCurrent = m_xXMLDocument->isCurrent(pBufferNode->getXMLElement());
- pBufferNode->setXMLElement(aElement);
-
- if (bIsCurrent)
- {
- m_xXMLDocument->setCurrentElement(aElement);
- }
- }
- }
- }
- else
- {
- removeElementCollector( id );
- }
-}
-
-cssu::Reference< cssxs::XDocumentHandler > SAL_CALL SAXEventKeeperImpl::setNextHandler(
- const cssu::Reference< cssxs::XDocumentHandler >& xNewHandler )
- throw (cssu::RuntimeException)
-{
- cssu::Reference< cssxs::XDocumentHandler > xOldHandler = m_xNextHandler;
-
- m_xNextHandler = xNewHandler;
- return xOldHandler;
-}
-
-rtl::OUString SAL_CALL SAXEventKeeperImpl::printBufferNodeTree()
- throw (cssu::RuntimeException)
-{
- rtl::OUString rc;
-
- rc += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "ElementMarkBuffers: size = " ));
- rc += rtl::OUString::valueOf((sal_Int32)m_vElementMarkBuffers.size());
- rc += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "\nCurrentBufferNode: " ));
- rc += m_xXMLDocument->getNodeName(m_pCurrentBufferNode->getXMLElement());
- rc += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "\n" ));
- rc += printBufferNode(m_pRootBufferNode, 0);
-
- return rc;
-}
-
-cssu::Reference< cssxw::XXMLElementWrapper > SAL_CALL SAXEventKeeperImpl::getCurrentBlockingNode()
- throw (cssu::RuntimeException)
-{
- cssu::Reference< cssxw::XXMLElementWrapper > rc;
-
- if (m_pCurrentBlockingBufferNode != NULL)
- {
- rc = m_pCurrentBlockingBufferNode->getXMLElement();
- }
-
- return rc;
-}
-
-/* XSecuritySAXEventKeeper */
-sal_Int32 SAL_CALL SAXEventKeeperImpl::addSecurityElementCollector(
- cssxc::sax::ElementMarkPriority priority,
- sal_Bool modifyElement )
- throw (cssu::RuntimeException)
-{
- return createElementCollector(
- cssxc::sax::ConstOfSecurityId::UNDEFINEDSECURITYID,
- priority,
- modifyElement,
- NULL);
-}
-
-sal_Int32 SAL_CALL SAXEventKeeperImpl::cloneElementCollector(
- sal_Int32 referenceId,
- cssxc::sax::ElementMarkPriority priority )
- throw (cssu::RuntimeException)
-{
- sal_Int32 nId = -1;
-
- ElementCollector* pElementCollector = (ElementCollector*)findElementMarkBuffer(referenceId);
- if (pElementCollector != NULL)
- {
- nId = m_nNextElementMarkId;
- m_nNextElementMarkId ++;
-
- ElementCollector* pClonedOne
- = pElementCollector->clone(nId, priority);
-
- /*
- * add this EC into the security data buffer array.
- */
- m_vElementMarkBuffers.push_back(pClonedOne);
-
- /*
- * If the reference EC is still in initial EC array, add
- * this cloned one into the initial EC array too.
- */
- if (pElementCollector->getBufferNode() == NULL)
- {
- m_vNewElementCollectors.push_back(pClonedOne);
- }
- }
-
- return nId;
-}
-
-void SAL_CALL SAXEventKeeperImpl::setSecurityId( sal_Int32 id, sal_Int32 securityId )
- throw (cssu::RuntimeException)
-{
- ElementMark* pElementMark = findElementMarkBuffer(id);
- if (pElementMark != NULL)
- {
- pElementMark->setSecurityId(securityId);
- }
-}
-
-
-/* XReferenceResolvedBroadcaster */
-void SAL_CALL SAXEventKeeperImpl::addReferenceResolvedListener(
- sal_Int32 referenceId,
- const cssu::Reference< cssxc::sax::XReferenceResolvedListener >& listener )
- throw (cssu::RuntimeException)
-{
- ElementCollector* pElementCollector = (ElementCollector*)findElementMarkBuffer(referenceId);
- if (pElementCollector != NULL)
- {
- pElementCollector->setReferenceResolvedListener(listener);
- }
-}
-
-void SAL_CALL SAXEventKeeperImpl::removeReferenceResolvedListener(
- sal_Int32 /*referenceId*/,
- const cssu::Reference< cssxc::sax::XReferenceResolvedListener >&)
- throw (cssu::RuntimeException)
-{
-}
-
-/* XSAXEventKeeperStatusChangeBroadcaster */
-void SAL_CALL SAXEventKeeperImpl::addSAXEventKeeperStatusChangeListener(
- const cssu::Reference< cssxc::sax::XSAXEventKeeperStatusChangeListener >& listener )
- throw (cssu::RuntimeException)
-{
- m_xSAXEventKeeperStatusChangeListener = listener;
-}
-
-void SAL_CALL SAXEventKeeperImpl::removeSAXEventKeeperStatusChangeListener(
- const cssu::Reference< cssxc::sax::XSAXEventKeeperStatusChangeListener >&)
- throw (cssu::RuntimeException)
-{
-}
-
-/* XDocumentHandler */
-void SAL_CALL SAXEventKeeperImpl::startDocument( )
- throw (cssxs::SAXException, cssu::RuntimeException)
-{
- if ( m_xNextHandler.is())
- {
- m_xNextHandler->startDocument();
- }
-}
-
-void SAL_CALL SAXEventKeeperImpl::endDocument( )
- throw (cssxs::SAXException, cssu::RuntimeException)
-{
- if ( m_xNextHandler.is())
- {
- m_xNextHandler->endDocument();
- }
-}
-
-void SAL_CALL SAXEventKeeperImpl::startElement(
- const rtl::OUString& aName,
- const cssu::Reference< cssxs::XAttributeList >& xAttribs )
- throw (cssxs::SAXException, cssu::RuntimeException)
-{
- /*
- * If there is a following handler and no blocking now, then
- * forward this event
- */
- if ((m_pCurrentBlockingBufferNode == NULL) &&
- (m_xNextHandler.is()) &&
- (!m_bIsForwarding) &&
- (m_pNewBlocker == NULL))
- {
- m_xNextHandler->startElement(aName, xAttribs);
- }
-
- /*
- * If not forwarding, buffer this startElement.
- */
- if (!m_bIsForwarding)
- {
- #ifndef _USECOMPRESSEDDOCUMENTHANDLER
- m_xDocumentHandler->startElement(aName, xAttribs);
- #else
- sal_Int32 nLength = xAttribs->getLength();
- cssu::Sequence< cssxcsax::XMLAttribute > aAttributes (nLength);
-
- for ( int i = 0; i<nLength; ++i )
- {
- aAttributes[i].sName = xAttribs->getNameByIndex((short)i);
- aAttributes[i].sValue =xAttribs->getValueByIndex((short)i);
- }
-
- m_xCompressedDocumentHandler->_startElement(aName, aAttributes);
- #endif
-
- }
-
- BufferNode* pBufferNode = addNewElementMarkBuffers();
- if (pBufferNode != NULL)
- {
- setCurrentBufferNode(pBufferNode);
- }
-}
-
-void SAL_CALL SAXEventKeeperImpl::endElement( const rtl::OUString& aName )
- throw (cssxs::SAXException, cssu::RuntimeException)
-{
- sal_Bool bIsCurrent = m_xXMLDocument->isCurrent(m_pCurrentBufferNode->getXMLElement());
-
- /*
- * If there is a following handler and no blocking now, then
- * forward this event
- */
- if ((m_pCurrentBlockingBufferNode == NULL) &&
- (m_xNextHandler.is()) &&
- (!m_bIsForwarding))
- {
- m_xNextHandler->endElement(aName);
- }
-
- if ((m_pCurrentBlockingBufferNode != NULL) ||
- (m_pCurrentBufferNode != m_pRootBufferNode) ||
- (!m_xXMLDocument->isCurrentElementEmpty()))
- {
- if (!m_bIsForwarding)
- {
- #ifndef _USECOMPRESSEDDOCUMENTHANDLER
- m_xDocumentHandler->endElement(aName);
- #else
- m_xCompressedDocumentHandler->_endElement(aName);
- #endif
- }
-
- /*
- * If the current buffer node has not notified yet, and
- * the current buffer node is waiting for the current element,
- * then let it notify.
- */
- if (bIsCurrent && (m_pCurrentBufferNode != m_pRootBufferNode))
- {
- BufferNode* pOldCurrentBufferNode = m_pCurrentBufferNode;
- m_pCurrentBufferNode = (BufferNode*)m_pCurrentBufferNode->getParent();
-
- pOldCurrentBufferNode->setReceivedAll();
-
- if ((m_pCurrentBufferNode == m_pRootBufferNode) &&
- m_xSAXEventKeeperStatusChangeListener.is())
- {
- m_xSAXEventKeeperStatusChangeListener->collectionStatusChanged(sal_False);
- }
- }
- }
- else
- {
- if (!m_bIsForwarding)
- {
- m_xXMLDocument->removeCurrentElement();
- }
- }
-}
-
-void SAL_CALL SAXEventKeeperImpl::characters( const rtl::OUString& aChars )
- throw (cssxs::SAXException, cssu::RuntimeException)
-{
- if (!m_bIsForwarding)
- {
- if ((m_pCurrentBlockingBufferNode == NULL) && m_xNextHandler.is())
- {
- m_xNextHandler->characters(aChars);
- }
-
- if ((m_pCurrentBlockingBufferNode != NULL) ||
- (m_pCurrentBufferNode != m_pRootBufferNode))
- {
- #ifndef _USECOMPRESSEDDOCUMENTHANDLER
- m_xDocumentHandler->characters(aChars);
- #else
- m_xCompressedDocumentHandler->_characters(aChars);
- #endif
- }
- }
-}
-
-void SAL_CALL SAXEventKeeperImpl::ignorableWhitespace( const rtl::OUString& aWhitespaces )
- throw (cssxs::SAXException, cssu::RuntimeException)
-{
- characters( aWhitespaces );
-}
-
-void SAL_CALL SAXEventKeeperImpl::processingInstruction(
- const rtl::OUString& aTarget, const rtl::OUString& aData )
- throw (cssxs::SAXException, cssu::RuntimeException)
-{
- if (!m_bIsForwarding)
- {
- if ((m_pCurrentBlockingBufferNode == NULL) && m_xNextHandler.is())
- {
- m_xNextHandler->processingInstruction(aTarget, aData);
- }
-
- if ((m_pCurrentBlockingBufferNode != NULL) ||
- (m_pCurrentBufferNode != m_pRootBufferNode))
- {
- #ifndef _USECOMPRESSEDDOCUMENTHANDLER
- m_xDocumentHandler->processingInstruction(aTarget, aData);
- #else
- m_xCompressedDocumentHandler->_processingInstruction(aTarget, aData);
- #endif
- }
- }
-}
-
-void SAL_CALL SAXEventKeeperImpl::setDocumentLocator( const cssu::Reference< cssxs::XLocator >&)
- throw (cssxs::SAXException, cssu::RuntimeException)
-{
-}
-
-/* XInitialization */
-void SAL_CALL SAXEventKeeperImpl::initialize( const cssu::Sequence< cssu::Any >& aArguments )
- throw (cssu::Exception, cssu::RuntimeException)
-{
- OSL_ASSERT(aArguments.getLength() == 1);
-
- aArguments[0] >>= m_xXMLDocument;
- m_xDocumentHandler = cssu::Reference< cssxs::XDocumentHandler >(
- m_xXMLDocument, cssu::UNO_QUERY );
- m_xCompressedDocumentHandler = cssu::Reference< cssxcsax::XCompressedDocumentHandler >(
- m_xXMLDocument, cssu::UNO_QUERY );
-
- m_pRootBufferNode = new BufferNode(m_xXMLDocument->getCurrentElement());
- m_pCurrentBufferNode = m_pRootBufferNode;
-}
-
-rtl::OUString SAXEventKeeperImpl_getImplementationName ()
- throw (cssu::RuntimeException)
-{
- return rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( IMPLEMENTATION_NAME ) );
-}
-
-sal_Bool SAL_CALL SAXEventKeeperImpl_supportsService( const rtl::OUString& ServiceName )
- throw (cssu::RuntimeException)
-{
- return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( SERVICE_NAME ));
-}
-
-cssu::Sequence< rtl::OUString > SAL_CALL SAXEventKeeperImpl_getSupportedServiceNames( )
- throw (cssu::RuntimeException)
-{
- cssu::Sequence < rtl::OUString > aRet(1);
- rtl::OUString* pArray = aRet.getArray();
- pArray[0] = rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME ) );
- return aRet;
-}
-#undef SERVICE_NAME
-
-cssu::Reference< cssu::XInterface > SAL_CALL SAXEventKeeperImpl_createInstance(
- const cssu::Reference< cssl::XMultiServiceFactory > &)
- throw( cssu::Exception )
-{
- return (cppu::OWeakObject*) new SAXEventKeeperImpl();
-}
-
-/* XServiceInfo */
-rtl::OUString SAL_CALL SAXEventKeeperImpl::getImplementationName( )
- throw (cssu::RuntimeException)
-{
- return SAXEventKeeperImpl_getImplementationName();
-}
-sal_Bool SAL_CALL SAXEventKeeperImpl::supportsService( const rtl::OUString& rServiceName )
- throw (cssu::RuntimeException)
-{
- return SAXEventKeeperImpl_supportsService( rServiceName );
-}
-cssu::Sequence< rtl::OUString > SAL_CALL SAXEventKeeperImpl::getSupportedServiceNames( )
- throw (cssu::RuntimeException)
-{
- return SAXEventKeeperImpl_getSupportedServiceNames();
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmlsecurity/source/framework/saxeventkeeperimpl.hxx b/xmlsecurity/source/framework/saxeventkeeperimpl.hxx
deleted file mode 100644
index e2cb197a5..000000000
--- a/xmlsecurity/source/framework/saxeventkeeperimpl.hxx
+++ /dev/null
@@ -1,365 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * 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
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _SAXEVENTKEEPERIMPL_HXX
-#define _SAXEVENTKEEPERIMPL_HXX
-
-#include <com/sun/star/xml/crypto/sax/XSecuritySAXEventKeeper.hpp>
-#include <com/sun/star/xml/crypto/sax/XReferenceResolvedBroadcaster.hpp>
-#include <com/sun/star/xml/crypto/sax/XSAXEventKeeperStatusChangeBroadcaster.hpp>
-#include <com/sun/star/xml/crypto/sax/XSAXEventKeeperStatusChangeListener.hpp>
-#include <com/sun/star/xml/csax/XCompressedDocumentHandler.hpp>
-#include <com/sun/star/xml/wrapper/XXMLDocumentWrapper.hpp>
-#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
-#include <com/sun/star/lang/XInitialization.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <cppuhelper/implbase6.hxx>
-
-#include "buffernode.hxx"
-#include "elementmark.hxx"
-#include "elementcollector.hxx"
-
-#ifndef INCLUDED_VECTOR
-#include <vector>
-#define INCLUDED_VECTOR
-#endif
-
-class SAXEventKeeperImpl : public cppu::WeakImplHelper6
-<
- com::sun::star::xml::crypto::sax::XSecuritySAXEventKeeper,
- com::sun::star::xml::crypto::sax::XReferenceResolvedBroadcaster,
- com::sun::star::xml::crypto::sax::XSAXEventKeeperStatusChangeBroadcaster,
- com::sun::star::xml::sax::XDocumentHandler,
- com::sun::star::lang::XInitialization,
- com::sun::star::lang::XServiceInfo
->
-/****** SAXEventKeeperImpl.hxx/CLASS SAXEventKeeperImpl ***********************
- *
- * NAME
- * SAXEventKeeperImpl -- SAX events buffer controller
- *
- * FUNCTION
- * Controls SAX events to be bufferred, and controls bufferred SAX events
- * to be released.
- *
- * AUTHOR
- * Michael Mi
- * Email: michael.mi@sun.com
- ******************************************************************************/
-{
-private:
- /*
- * the XMLDocumentWrapper component which maintains all bufferred SAX
- * in DOM format.
- */
- com::sun::star::uno::Reference<
- com::sun::star::xml::wrapper::XXMLDocumentWrapper >
- m_xXMLDocument;
-
- /*
- * the document handler provided by the XMLDocumentWrapper component.
- */
- com::sun::star::uno::Reference<
- com::sun::star::xml::sax::XDocumentHandler > m_xDocumentHandler;
-
- /*
- * the compressed document handler provided by the XMLDocumentWrapper
- * component, the handler has more effient method definition that the
- * normal document handler.
- */
- com::sun::star::uno::Reference<
- com::sun::star::xml::csax::XCompressedDocumentHandler >
- m_xCompressedDocumentHandler;
-
- /*
- * a listener which receives this SAXEventKeeper's status change
- * notification.
- * Based on the status changes, the listener can decide whether the
- * SAXEventKeeper should chain on/chain off the SAX chain, or whether
- * the SAXEventKeeper is useless any long.
- */
- com::sun::star::uno::Reference<
- com::sun::star::xml::crypto::sax::XSAXEventKeeperStatusChangeListener >
- m_xSAXEventKeeperStatusChangeListener;
-
- /*
- * the root node of the BufferNode tree.
- * the BufferNode tree is used to keep track of all bufferred elements,
- * it has the same structure with the document which maintains those
- * elements physically.
- */
- BufferNode* m_pRootBufferNode;
-
- /*
- * the current active BufferNode.
- * this is used to keep track the current location in the BufferNode tree,
- * the next generated BufferNode will become a child BufferNode of it.
- */
- BufferNode* m_pCurrentBufferNode;
-
- /*
- * the next Id for a coming ElementMark.
- * the variable is increased by 1 when an new ElementMark is generated,
- * in this way, we can promise the Id of any ElementMark is unique.
- */
- sal_Int32 m_nNextElementMarkId;
-
- /*
- * maintains a collection of all ElementMarks.
- */
- std::vector< const ElementMark* > m_vElementMarkBuffers;
-
- /*
- * maintains a list of new ElementCollectors that will be created
- * on the element represented by the next incoming startElement SAX
- * event.
- * The reason that such the m_vNewElementCollectors is necessary
- * is: when an ElementCollector is asked to create, it can't be
- * created completely at once, because the BufferNode it will be
- * working on has not been created until the next startElement
- * SAX event comes.
- */
- std::vector< const ElementCollector* > m_vNewElementCollectors;
-
- /*
- * maintains the new Blocker that will be created
- * on the element represented by the next incoming startElement SAX
- * event.
- */
- ElementMark* m_pNewBlocker;
-
- /*
- * the document handler to which all received SAX events will be
- * forwarded.
- */
- com::sun::star::uno::Reference<
- com::sun::star::xml::sax::XDocumentHandler > m_xNextHandler;
-
- /*
- * the current BufferNode which prevents the SAX events to be
- * forwarded to the m_xNextHandler.
- */
- BufferNode* m_pCurrentBlockingBufferNode;
-
- /*
- * maintains a list of ElementMark that has been asked to release.
- * Because during processing a request of releasing an ElementMark,
- * another releasing ElementMark request can be invoked. To avoid
- * reentering the same method, a such request only add that ElementMark
- * into this ElementMark list, then all ElementMarks will be processed in
- * order.
- */
- std::vector< sal_Int32 > m_vReleasedElementMarkBuffers;
-
- /*
- * a flag to indicate whether the ElementMark releasing process is runing.
- * When a releasing request comes, the assigned ElementMark is added to
- * the m_vReleasedElementMarkBuffers first, then this flag is checked.
- * If the ElementMark releasing process is not running, then call that
- * method.
- */
- bool m_bIsReleasing;
-
- /*
- * a flag to indicate whether it is the "Forwarding" mode now.
- * A "Forwarding" mode means that all received SAX events are from the
- * XMLDocumentWrapper component, instead of up-stream component in the
- * SAX chain.
- * The difference between "Forwarding" mode and normal mode is that:
- * no SAX events need to be transferred to the XMLDocumentWrapper component
- * again even if a buffer request happens.
- */
- bool m_bIsForwarding;
-
- void setCurrentBufferNode(BufferNode* pBufferNode);
-
- BufferNode* addNewElementMarkBuffers();
-
- ElementMark* findElementMarkBuffer(sal_Int32 nId) const;
-
- void removeElementMarkBuffer(sal_Int32 nId);
-
- rtl::OUString printBufferNode(
- BufferNode* pBufferNode, sal_Int32 nIndent) const;
-
- com::sun::star::uno::Sequence< com::sun::star::uno::Reference<
- com::sun::star::xml::wrapper::XXMLElementWrapper > >
- collectChildWorkingElement(BufferNode* pBufferNode) const;
-
- void smashBufferNode(
- BufferNode* pBufferNode, bool bClearRoot) const;
-
- BufferNode* findNextBlockingBufferNode(
- BufferNode* pStartBufferNode) const;
-
- void diffuse(BufferNode* pBufferNode) const;
-
- void releaseElementMarkBuffer();
-
- void markElementMarkBuffer(sal_Int32 nId);
-
- sal_Int32 createElementCollector(
- sal_Int32 nSecurityId,
- com::sun::star::xml::crypto::sax::ElementMarkPriority nPriority,
- bool bModifyElement,
- const com::sun::star::uno::Reference<
- com::sun::star::xml::crypto::sax::XReferenceResolvedListener>&
- xReferenceResolvedListener);
-
- sal_Int32 createBlocker(sal_Int32 nSecurityId);
-
-public:
- SAXEventKeeperImpl();
- virtual ~SAXEventKeeperImpl();
-
- /* XSAXEventKeeper */
- virtual sal_Int32 SAL_CALL addElementCollector( )
- throw (com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeElementCollector( sal_Int32 id )
- throw (com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL addBlocker( )
- throw (com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeBlocker( sal_Int32 id )
- throw (com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isBlocking( )
- throw (com::sun::star::uno::RuntimeException);
- virtual com::sun::star::uno::Reference<
- com::sun::star::xml::wrapper::XXMLElementWrapper > SAL_CALL
- getElement( sal_Int32 id )
- throw (com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setElement(
- sal_Int32 id,
- const com::sun::star::uno::Reference<
- com::sun::star::xml::wrapper::XXMLElementWrapper >&
- aElement )
- throw (com::sun::star::uno::RuntimeException);
- virtual com::sun::star::uno::Reference<
- com::sun::star::xml::sax::XDocumentHandler > SAL_CALL
- setNextHandler( const com::sun::star::uno::Reference<
- com::sun::star::xml::sax::XDocumentHandler >& xNewHandler )
- throw (com::sun::star::uno::RuntimeException);
- virtual rtl::OUString SAL_CALL printBufferNodeTree()
- throw (com::sun::star::uno::RuntimeException);
- virtual com::sun::star::uno::Reference<
- com::sun::star::xml::wrapper::XXMLElementWrapper > SAL_CALL
- getCurrentBlockingNode()
- throw (com::sun::star::uno::RuntimeException);
-
- /* XSecuritySAXEventKeeper */
- virtual sal_Int32 SAL_CALL addSecurityElementCollector(
- com::sun::star::xml::crypto::sax::ElementMarkPriority priority,
- sal_Bool modifyElement )
- throw (com::sun::star::uno::RuntimeException);
- virtual sal_Int32 SAL_CALL cloneElementCollector(
- sal_Int32 referenceId,
- com::sun::star::xml::crypto::sax::ElementMarkPriority priority )
- throw (com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setSecurityId( sal_Int32 id, sal_Int32 securityId )
- throw (com::sun::star::uno::RuntimeException);
-
- /* XReferenceResolvedBroadcaster */
- virtual void SAL_CALL addReferenceResolvedListener(
- sal_Int32 referenceId,
- const com::sun::star::uno::Reference<
- com::sun::star::xml::crypto::sax::XReferenceResolvedListener >&
- listener )
- throw (com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeReferenceResolvedListener(
- sal_Int32 referenceId,
- const com::sun::star::uno::Reference<
- com::sun::star::xml::crypto::sax::XReferenceResolvedListener >&
- listener )
- throw (com::sun::star::uno::RuntimeException);
-
- /* XSAXEventKeeperStatusChangeBroadcaster */
- virtual void SAL_CALL addSAXEventKeeperStatusChangeListener(
- const com::sun::star::uno::Reference<
- com::sun::star::xml::crypto::sax::XSAXEventKeeperStatusChangeListener >&
- listener )
- throw (com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeSAXEventKeeperStatusChangeListener(
- const com::sun::star::uno::Reference<
- com::sun::star::xml::crypto::sax::XSAXEventKeeperStatusChangeListener >&
- listener )
- throw (com::sun::star::uno::RuntimeException);
-
- /* XDocumentHandler */
- virtual void SAL_CALL startDocument( )
- throw (com::sun::star::xml::sax::SAXException, com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL endDocument( )
- throw (com::sun::star::xml::sax::SAXException, com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL startElement(
- const rtl::OUString& aName,
- const com::sun::star::uno::Reference< com::sun::star::xml::sax::XAttributeList >&
- xAttribs )
- throw (com::sun::star::xml::sax::SAXException, com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL endElement( const rtl::OUString& aName )
- throw (com::sun::star::xml::sax::SAXException, com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL characters( const rtl::OUString& aChars )
- throw (com::sun::star::xml::sax::SAXException, com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL ignorableWhitespace( const rtl::OUString& aWhitespaces )
- throw (com::sun::star::xml::sax::SAXException, com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL processingInstruction(
- const rtl::OUString& aTarget, const rtl::OUString& aData )
- throw (com::sun::star::xml::sax::SAXException, com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setDocumentLocator(
- const com::sun::star::uno::Reference< com::sun::star::xml::sax::XLocator >& xLocator )
- throw (com::sun::star::xml::sax::SAXException, com::sun::star::uno::RuntimeException);
-
- /* XInitialization */
- virtual void SAL_CALL initialize(
- const com::sun::star::uno::Sequence< com::sun::star::uno::Any >& aArguments )
- throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException);
-
- /* XServiceInfo */
- virtual rtl::OUString SAL_CALL getImplementationName( )
- throw (com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsService( const rtl::OUString& ServiceName )
- throw (com::sun::star::uno::RuntimeException);
- virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames( )
- throw (com::sun::star::uno::RuntimeException);
-};
-
-rtl::OUString SAXEventKeeperImpl_getImplementationName()
- throw ( com::sun::star::uno::RuntimeException );
-
-sal_Bool SAL_CALL SAXEventKeeperImpl_supportsService( const rtl::OUString& ServiceName )
- throw ( com::sun::star::uno::RuntimeException );
-
-com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL SAXEventKeeperImpl_getSupportedServiceNames( )
- throw ( com::sun::star::uno::RuntimeException );
-
-com::sun::star::uno::Reference< com::sun::star::uno::XInterface >
-SAL_CALL SAXEventKeeperImpl_createInstance( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > & rSMgr)
- throw ( com::sun::star::uno::Exception );
-
-#endif
-
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmlsecurity/source/framework/securityengine.cxx b/xmlsecurity/source/framework/securityengine.cxx
deleted file mode 100644
index a7cf002c0..000000000
--- a/xmlsecurity/source/framework/securityengine.cxx
+++ /dev/null
@@ -1,90 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * 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
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_xmlsecurity.hxx"
-
-#include "securityengine.hxx"
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-
-namespace cssu = com::sun::star::uno;
-namespace cssl = com::sun::star::lang;
-namespace cssxc = com::sun::star::xml::crypto;
-namespace cssxw = com::sun::star::xml::wrapper;
-
-#define DECLARE_ASCII( SASCIIVALUE ) \
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SASCIIVALUE ) )
-
-SecurityEngine::SecurityEngine( const cssu::Reference< cssl::XMultiServiceFactory >& rxMSF )
- :mxMSF( rxMSF ),
- m_nIdOfTemplateEC(-1),
- m_nNumOfResolvedReferences(0),
- m_nIdOfKeyEC(-1),
- m_bMissionDone(false),
- m_nSecurityId(-1),
- m_nStatus(::com::sun::star::xml::crypto::SecurityOperationStatus_UNKNOWN)
-{
-}
-
-/* XReferenceResolvedListener */
-void SAL_CALL SecurityEngine::referenceResolved( sal_Int32 /*referenceId*/)
- throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException)
-{
- m_nNumOfResolvedReferences++;
- tryToPerform();
-}
-
-/* XKeyCollector */
-void SAL_CALL SecurityEngine::setKeyId( sal_Int32 id )
- throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException)
-{
- m_nIdOfKeyEC = id;
- tryToPerform();
-}
-
-/* XMissionTaker */
-sal_Bool SAL_CALL SecurityEngine::endMission( )
- throw (com::sun::star::uno::RuntimeException)
-{
- sal_Bool rc = m_bMissionDone;
-
- if (!rc)
- {
- clearUp( );
-
- notifyResultListener();
- m_bMissionDone = true;
- }
-
- m_xResultListener = NULL;
- m_xSAXEventKeeper = NULL;
-
- return rc;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmlsecurity/source/framework/securityengine.hxx b/xmlsecurity/source/framework/securityengine.hxx
deleted file mode 100644
index fb4c3cd44..000000000
--- a/xmlsecurity/source/framework/securityengine.hxx
+++ /dev/null
@@ -1,169 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * 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
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _SECURITYENGINE_HXX
-#define _SECURITYENGINE_HXX
-
-#include <com/sun/star/xml/crypto/sax/XReferenceResolvedListener.hpp>
-#include <com/sun/star/xml/crypto/sax/XReferenceResolvedBroadcaster.hpp>
-#include <com/sun/star/xml/crypto/sax/XKeyCollector.hpp>
-#include <com/sun/star/xml/crypto/sax/XMissionTaker.hpp>
-#include <com/sun/star/xml/crypto/sax/XSAXEventKeeper.hpp>
-#include <com/sun/star/xml/crypto/XXMLSignature.hpp>
-
-#include <cppuhelper/implbase3.hxx>
-
-class SecurityEngine : public cppu::WeakImplHelper3
-<
- com::sun::star::xml::crypto::sax::XReferenceResolvedListener,
- com::sun::star::xml::crypto::sax::XKeyCollector,
- com::sun::star::xml::crypto::sax::XMissionTaker
->
-/****** securityengine.hxx/CLASS SecurityEngine *******************************
- *
- * NAME
- * SecurityEngine -- Base class of SignatureEngine and EncryptionEngine
- *
- * FUNCTION
- * Maintains common members and methods related with security engine
- * operation.
- *
- * AUTHOR
- * Michael Mi
- * Email: michael.mi@sun.com
- ******************************************************************************/
-{
-protected:
- com::sun::star::uno::Reference<
- com::sun::star::lang::XMultiServiceFactory > mxMSF;
-
- /*
- * A SAXEventKeeper internally maintians all resources that a security
- * operation needs. The m_xSAXEventKeeper member is used to release
- * those resources when the security operation finishes.
- */
- com::sun::star::uno::Reference<
- com::sun::star::xml::crypto::sax::XSAXEventKeeper > m_xSAXEventKeeper;
-
- /*
- * the id of ElementCollector of the template element.
- * For a signature, the template element is the Signature element,
- * for a encryption, the EncryptedData/EncryptedKey element is.
- */
- sal_Int32 m_nIdOfTemplateEC;
-
- /*
- * remembers how many referenced elements have been bufferred completely,
- * including the key element, template element, and referenced element of
- * signature.
- */
- sal_Int32 m_nNumOfResolvedReferences;
-
- /*
- * the id of ElementCollector of the key element.
- * If a Signature element or EncryptedData/EncryptedKey element has
- * an internal key sub-element, then this member should be -1
- */
- sal_Int32 m_nIdOfKeyEC;
-
- /*
- * remembers whether the current opertion has finished.
- */
- bool m_bMissionDone;
-
- /*
- * the Id of the security entity, a signature or encryption, which is used for
- * the result listener to identify the entity.
- */
- sal_Int32 m_nSecurityId;
-
- /*
- * the status of the operation
- */
- com::sun::star::xml::crypto::SecurityOperationStatus m_nStatus;
-
- /*
- * the result listener, which will receives the security operation result.
- */
- com::sun::star::uno::Reference<
- com::sun::star::uno::XInterface >
- m_xResultListener;
-
-protected:
- explicit SecurityEngine( const com::sun::star::uno::Reference<
- com::sun::star::lang::XMultiServiceFactory >& rxMSF = NULL );
- virtual ~SecurityEngine() {};
-
- /*
- * perform the security operation.
- * Any derived class will implement this method respectively.
- */
- virtual void tryToPerform( )
- throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException){};
-
- /*
- * clear up all resources used by this operation.
- * This method is called after the operation finishes, or a End-Your-Mission
- * message is received.
- * Any derived class will implement this method respectively.
- */
- virtual void clearUp( ) const {};
-
- /*
- * notifies any possible result listener.
- * When verify a signature or conduct a decryption, the operation result will
- * be transferred to a listener by this method.
- * Any derived class will implement this method respectively.
- */
- virtual void notifyResultListener() const
- throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException)
- {};
-
- /*
- * checks whether everything is ready.
- * Any derived class will implement this method respectively.
- */
- virtual bool checkReady() const { return true; };
-
-public:
- /* XReferenceResolvedListener */
- virtual void SAL_CALL referenceResolved( sal_Int32 referenceId )
- throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException);
-
- /* XKeyCollector */
- virtual void SAL_CALL setKeyId( sal_Int32 id )
- throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException);
-
- /* XMissionTaker */
- virtual sal_Bool SAL_CALL endMission( )
- throw (com::sun::star::uno::RuntimeException);
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmlsecurity/source/framework/signaturecreatorimpl.cxx b/xmlsecurity/source/framework/signaturecreatorimpl.cxx
deleted file mode 100644
index dafdbb8c3..000000000
--- a/xmlsecurity/source/framework/signaturecreatorimpl.cxx
+++ /dev/null
@@ -1,287 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * 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
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_xmlsecurity.hxx"
-
-#include "signaturecreatorimpl.hxx"
-#include <com/sun/star/xml/crypto/XXMLSignatureTemplate.hpp>
-#include <com/sun/star/xml/wrapper/XXMLElementWrapper.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-
-namespace cssu = com::sun::star::uno;
-namespace cssl = com::sun::star::lang;
-namespace cssxc = com::sun::star::xml::crypto;
-namespace cssxw = com::sun::star::xml::wrapper;
-
-#define SERVICE_NAME "com.sun.star.xml.crypto.sax.SignatureCreator"
-#define IMPLEMENTATION_NAME "com.sun.star.xml.security.framework.SignatureCreatorImpl"
-
-#define DECLARE_ASCII( SASCIIVALUE ) \
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SASCIIVALUE ) )
-
-SignatureCreatorImpl::SignatureCreatorImpl( const cssu::Reference< cssl::XMultiServiceFactory >& rxMSF )
- :m_nIdOfBlocker(-1)
-{
- mxMSF = rxMSF;
-}
-
-SignatureCreatorImpl::~SignatureCreatorImpl( )
-{
-}
-
-bool SignatureCreatorImpl::checkReady() const
-/****** SignatureCreatorImpl/checkReady **************************************
- *
- * NAME
- * checkReady -- checks the conditions for the signature generation.
- *
- * SYNOPSIS
- * bReady = checkReady( );
- *
- * FUNCTION
- * checks whether all following conditions are satisfied:
- * 1. the result listener is ready;
- * 2. the id of the template blocker is known;
- * 3. the SignatureEngine is ready.
- *
- * INPUTS
- * empty
- *
- * RESULT
- * bReady - true if all conditions are satisfied, false otherwise
- *
- * AUTHOR
- * Michael Mi
- * Email: michael.mi@sun.com
- ******************************************************************************/
-{
- return (m_xResultListener.is() &&
- (m_nIdOfBlocker != -1) &&
- SignatureEngine::checkReady());
-}
-
-void SignatureCreatorImpl::notifyResultListener() const
- throw (cssu::Exception, cssu::RuntimeException)
-/****** SignatureCreatorImpl/notifyResultListener *****************************
- *
- * NAME
- * notifyResultListener -- notifies the listener about the signature
- * creation result.
- *
- * SYNOPSIS
- * notifyResultListener( );
- *
- * FUNCTION
- * see NAME.
- *
- * INPUTS
- * empty
- *
- * RESULT
- * empty
- *
- * AUTHOR
- * Michael Mi
- * Email: michael.mi@sun.com
- ******************************************************************************/
-{
- cssu::Reference< cssxc::sax::XSignatureCreationResultListener >
- xSignatureCreationResultListener ( m_xResultListener , cssu::UNO_QUERY ) ;
-
- xSignatureCreationResultListener->signatureCreated( m_nSecurityId, m_nStatus );
-}
-
-void SignatureCreatorImpl::startEngine( const cssu::Reference<
- cssxc::XXMLSignatureTemplate >&
- xSignatureTemplate)
- throw (cssu::Exception, cssu::RuntimeException)
-/****** SignatureCreatorImpl/startEngine *************************************
- *
- * NAME
- * startEngine -- generates the signature.
- *
- * SYNOPSIS
- * startEngine( xSignatureTemplate );
- *
- * FUNCTION
- * generates the signature element, then if succeeds, updates the link
- * of old template element to the new signature element in
- * SAXEventKeeper.
- *
- * INPUTS
- * xSignatureTemplate - the signature template (along with all referenced
- * elements) to be signed.
- *
- * RESULT
- * empty
- *
- * AUTHOR
- * Michael Mi
- * Email: michael.mi@sun.com
- ******************************************************************************/
-{
- cssu::Reference< cssxc::XXMLSignatureTemplate > xResultTemplate;
- try
- {
- xResultTemplate = m_xXMLSignature->generate(xSignatureTemplate, m_xSecurityEnvironment);
- m_nStatus = xResultTemplate->getStatus();
- }
- catch( cssu::Exception& )
- {
- m_nStatus = cssxc::SecurityOperationStatus_RUNTIMEERROR_FAILED;
- }
-
- if (m_nStatus == cssxc::SecurityOperationStatus_OPERATION_SUCCEEDED)
- {
- cssu::Reference < cssxw::XXMLElementWrapper > xResultSignature = xResultTemplate->getTemplate();
- m_xSAXEventKeeper->setElement(m_nIdOfTemplateEC, xResultSignature);
- }
-}
-
-void SignatureCreatorImpl::clearUp() const
-/****** SignatureCreatorImpl/clearUp *****************************************
- *
- * NAME
- * clearUp -- clear up all resources used by the signature generation.
- *
- * SYNOPSIS
- * clearUp( );
- *
- * FUNCTION
- * cleaning resources up includes:
- * 1. SignatureEngine's clearing up;
- * 2. releases the Blocker for the signature template element.
- *
- * INPUTS
- * empty
- *
- * RESULT
- * empty
- *
- * AUTHOR
- * Michael Mi
- * Email: michael.mi@sun.com
- ******************************************************************************/
-{
- SignatureEngine::clearUp();
-
- if (m_nIdOfBlocker != -1)
- {
- m_xSAXEventKeeper->removeBlocker(m_nIdOfBlocker);
- }
-}
-
-/* XBlockerMonitor */
-void SAL_CALL SignatureCreatorImpl::setBlockerId( sal_Int32 id )
- throw (cssu::Exception, cssu::RuntimeException)
-{
- m_nIdOfBlocker = id;
- tryToPerform();
-}
-
-/* XSignatureCreationResultBroadcaster */
-void SAL_CALL SignatureCreatorImpl::addSignatureCreationResultListener(
- const cssu::Reference< cssxc::sax::XSignatureCreationResultListener >& listener )
- throw (cssu::Exception, cssu::RuntimeException)
-{
- m_xResultListener = listener;
- tryToPerform();
-}
-
-void SAL_CALL SignatureCreatorImpl::removeSignatureCreationResultListener(
- const cssu::Reference< cssxc::sax::XSignatureCreationResultListener >&)
- throw (cssu::RuntimeException)
-{
-}
-
-/* XInitialization */
-void SAL_CALL SignatureCreatorImpl::initialize( const cssu::Sequence< cssu::Any >& aArguments )
- throw (cssu::Exception, cssu::RuntimeException)
-{
- OSL_ASSERT(aArguments.getLength() == 5);
-
- rtl::OUString ouTempString;
-
- aArguments[0] >>= ouTempString;
- m_nSecurityId = ouTempString.toInt32();
- aArguments[1] >>= m_xSAXEventKeeper;
- aArguments[2] >>= ouTempString;
- m_nIdOfTemplateEC = ouTempString.toInt32();
- aArguments[3] >>= m_xSecurityEnvironment;
- aArguments[4] >>= m_xXMLSignature;
-}
-
-
-rtl::OUString SignatureCreatorImpl_getImplementationName ()
- throw (cssu::RuntimeException)
-{
- return rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( IMPLEMENTATION_NAME ) );
-}
-
-sal_Bool SAL_CALL SignatureCreatorImpl_supportsService( const rtl::OUString& ServiceName )
- throw (cssu::RuntimeException)
-{
- return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( SERVICE_NAME ));
-}
-
-cssu::Sequence< rtl::OUString > SAL_CALL SignatureCreatorImpl_getSupportedServiceNames( )
- throw (cssu::RuntimeException)
-{
- cssu::Sequence < rtl::OUString > aRet(1);
- rtl::OUString* pArray = aRet.getArray();
- pArray[0] = rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME ) );
- return aRet;
-}
-#undef SERVICE_NAME
-
-cssu::Reference< cssu::XInterface > SAL_CALL SignatureCreatorImpl_createInstance(
- const cssu::Reference< cssl::XMultiServiceFactory >& rSMgr)
- throw( cssu::Exception )
-{
- return (cppu::OWeakObject*) new SignatureCreatorImpl( rSMgr );
-}
-
-/* XServiceInfo */
-rtl::OUString SAL_CALL SignatureCreatorImpl::getImplementationName( )
- throw (cssu::RuntimeException)
-{
- return SignatureCreatorImpl_getImplementationName();
-}
-sal_Bool SAL_CALL SignatureCreatorImpl::supportsService( const rtl::OUString& rServiceName )
- throw (cssu::RuntimeException)
-{
- return SignatureCreatorImpl_supportsService( rServiceName );
-}
-cssu::Sequence< rtl::OUString > SAL_CALL SignatureCreatorImpl::getSupportedServiceNames( )
- throw (cssu::RuntimeException)
-{
- return SignatureCreatorImpl_getSupportedServiceNames();
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmlsecurity/source/framework/signaturecreatorimpl.hxx b/xmlsecurity/source/framework/signaturecreatorimpl.hxx
deleted file mode 100644
index dc753baaa..000000000
--- a/xmlsecurity/source/framework/signaturecreatorimpl.hxx
+++ /dev/null
@@ -1,145 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * 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
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _SIGNATURECREATORIMPL_HXX
-#define _SIGNATURECREATORIMPL_HXX
-
-#include <com/sun/star/xml/crypto/sax/XBlockerMonitor.hpp>
-#include <com/sun/star/xml/crypto/sax/XSignatureCreationResultListener.hpp>
-#include <com/sun/star/xml/crypto/sax/XSignatureCreationResultBroadcaster.hpp>
-#include <com/sun/star/xml/crypto/XSecurityEnvironment.hpp>
-#include <com/sun/star/lang/XInitialization.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <cppuhelper/implbase4.hxx>
-
-#include "signatureengine.hxx"
-
-class SignatureCreatorImpl : public cppu::ImplInheritanceHelper4
-<
- SignatureEngine,
- com::sun::star::xml::crypto::sax::XBlockerMonitor,
- com::sun::star::xml::crypto::sax::XSignatureCreationResultBroadcaster,
- com::sun::star::lang::XInitialization,
- com::sun::star::lang::XServiceInfo
->
-/****** SignatureCreatorImpl.hxx/CLASS SignatureCreatorImpl *******************
- *
- * NAME
- * SignatureCreatorImpl -- generates a signature
- *
- * FUNCTION
- * Collects all resources for a signature generation, then generates the
- * signature by invoking a xmlsec-based signature bridge component.
- *
- * AUTHOR
- * Michael Mi
- * Email: michael.mi@sun.com
- ******************************************************************************/
-{
-private:
- /*
- * the Id of the signature, which is used for the result listener to
- * identify the signature.
- */
- sal_Int32 m_nSignatureId;
-
- /*
- * the Id of template blocker.
- */
- sal_Int32 m_nIdOfBlocker;
-
- /*
- * the signature creation result
- */
- bool m_bCreationSucceed;
-
- com::sun::star::uno::Reference<
- com::sun::star::xml::crypto::XSecurityEnvironment > m_xSecurityEnvironment;
-
- virtual void notifyResultListener() const
- throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException);
- virtual void clearUp( ) const;
- virtual bool checkReady() const;
- virtual void startEngine( const com::sun::star::uno::Reference<
- com::sun::star::xml::crypto::XXMLSignatureTemplate >&
- xSignatureTemplate)
- throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException);
-
-public:
- explicit SignatureCreatorImpl( const com::sun::star::uno::Reference<
- com::sun::star::lang::XMultiServiceFactory >& rxMSF);
- virtual ~SignatureCreatorImpl();
-
- /* XBlockerMonitor */
- virtual void SAL_CALL setBlockerId( sal_Int32 id )
- throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException);
-
- /* XSignatureCreationResultBroadcaster */
- void SAL_CALL addSignatureCreationResultListener(
- const com::sun::star::uno::Reference<
- com::sun::star::xml::crypto::sax::XSignatureCreationResultListener >& listener )
- throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException);
-
- void SAL_CALL removeSignatureCreationResultListener(
- const com::sun::star::uno::Reference<
- com::sun::star::xml::crypto::sax::XSignatureCreationResultListener >& listener )
- throw (com::sun::star::uno::RuntimeException);
-
- /* XInitialization */
- virtual void SAL_CALL initialize(
- const com::sun::star::uno::Sequence< com::sun::star::uno::Any >& aArguments )
- throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException);
-
- /* XServiceInfo */
- virtual rtl::OUString SAL_CALL getImplementationName( )
- throw (com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsService( const rtl::OUString& ServiceName )
- throw (com::sun::star::uno::RuntimeException);
- virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames( )
- throw (com::sun::star::uno::RuntimeException);
-};
-
-rtl::OUString SignatureCreatorImpl_getImplementationName()
- throw ( com::sun::star::uno::RuntimeException );
-
-sal_Bool SAL_CALL SignatureCreatorImpl_supportsService( const rtl::OUString& ServiceName )
- throw ( com::sun::star::uno::RuntimeException );
-
-com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL SignatureCreatorImpl_getSupportedServiceNames( )
- throw ( com::sun::star::uno::RuntimeException );
-
-com::sun::star::uno::Reference< com::sun::star::uno::XInterface >
-SAL_CALL SignatureCreatorImpl_createInstance(
- const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > & rSMgr)
- throw ( com::sun::star::uno::Exception );
-
-#endif
-
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmlsecurity/source/framework/signatureengine.cxx b/xmlsecurity/source/framework/signatureengine.cxx
deleted file mode 100644
index 1c2dd4b32..000000000
--- a/xmlsecurity/source/framework/signatureengine.cxx
+++ /dev/null
@@ -1,262 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * 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
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_xmlsecurity.hxx"
-
-#include "signatureengine.hxx"
-#include <com/sun/star/xml/crypto/XXMLSignatureTemplate.hpp>
-#include <com/sun/star/xml/wrapper/XXMLElementWrapper.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-
-namespace cssu = com::sun::star::uno;
-namespace cssl = com::sun::star::lang;
-namespace cssxc = com::sun::star::xml::crypto;
-namespace cssxw = com::sun::star::xml::wrapper;
-
-#define SIGNATURE_TEMPLATE "com.sun.star.xml.crypto.XMLSignatureTemplate"
-
-#define DECLARE_ASCII( SASCIIVALUE ) \
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SASCIIVALUE ) )
-
-SignatureEngine::SignatureEngine( )
- :m_nTotalReferenceNumber(-1)
-{
-}
-
-bool SignatureEngine::checkReady() const
-/****** SignatureEngine/checkReady *******************************************
- *
- * NAME
- * checkReady -- checks the conditions for the main operation.
- *
- * SYNOPSIS
- * 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.
- *
- * INPUTS
- * empty
- *
- * RESULT
- * bReady - true if all conditions are satisfied, false otherwise
- *
- * AUTHOR
- * Michael Mi
- * Email: michael.mi@sun.com
- ******************************************************************************/
-{
- bool rc = true;
-
- sal_Int32 nKeyInc = 0;
- if (m_nIdOfKeyEC != 0)
- {
- nKeyInc = 1;
- }
-
- if (m_bMissionDone ||
- m_nIdOfKeyEC == -1 ||
- m_nTotalReferenceNumber == -1 ||
- m_nTotalReferenceNumber+1+nKeyInc > m_nNumOfResolvedReferences)
- {
- rc = false;
- }
-
- return rc;
-}
-
-void SignatureEngine::tryToPerform( )
- throw (cssu::Exception, cssu::RuntimeException)
-/****** SignatureEngine/tryToPerform *****************************************
- *
- * NAME
- * tryToPerform -- tries to perform the signature operation.
- *
- * SYNOPSIS
- * 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.
- *
- * INPUTS
- * empty
- *
- * RESULT
- * empty
- *
- * AUTHOR
- * Michael Mi
- * Email: michael.mi@sun.com
- ******************************************************************************/
-{
- if (checkReady())
- {
- const rtl::OUString ouSignatureTemplate (
- 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 )
- {
- xXMLElement = m_xSAXEventKeeper->getElement( *ii );
- xSignatureTemplate->setTarget(xXMLElement);
- }
-
- /*
- * set the Uri binding
- */
- xSignatureTemplate->setBinding( this );
-
- startEngine( xSignatureTemplate );
-
- /*
- * done
- */
- clearUp( );
-
- notifyResultListener();
-
- m_bMissionDone = true;
- }
-}
-
-void SignatureEngine::clearUp( ) const
-/****** SignatureEngine/clearUp **********************************************
- *
- * NAME
- * clearUp -- clear up all resources used by this operation.
- *
- * SYNOPSIS
- * 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.
- *
- * INPUTS
- * empty
- *
- * RESULT
- * empty
- *
- * AUTHOR
- * Michael Mi
- * Email: michael.mi@sun.com
- ******************************************************************************/
-{
- cssu::Reference < cssxc::sax::XReferenceResolvedBroadcaster >
- xReferenceResolvedBroadcaster( m_xSAXEventKeeper, cssu::UNO_QUERY );
- xReferenceResolvedBroadcaster->removeReferenceResolvedListener(
- 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 )
- {
- xReferenceResolvedBroadcaster->removeReferenceResolvedListener(
- *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);
- }
-}
-
-/* XReferenceCollector */
-void SAL_CALL SignatureEngine::setReferenceCount( sal_Int32 count )
- throw (cssu::Exception, cssu::RuntimeException)
-{
- m_nTotalReferenceNumber = count;
- tryToPerform();
-}
-
-void SAL_CALL SignatureEngine::setReferenceId( sal_Int32 id )
- throw (cssu::Exception, cssu::RuntimeException)
-{
- m_vReferenceIds.push_back( id );
-}
-
-/* XUriBinding */
-void SAL_CALL SignatureEngine::setUriBinding(
- const rtl::OUString& uri,
- const cssu::Reference< com::sun::star::io::XInputStream >& aInputStream )
- throw (cssu::Exception, cssu::RuntimeException)
-{
- 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)
- {
- xInputStream = m_vXInputStreams[i];
- break;
- }
- }
-
- return xInputStream;
-}
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmlsecurity/source/framework/signatureengine.hxx b/xmlsecurity/source/framework/signatureengine.hxx
deleted file mode 100644
index 8d323e003..000000000
--- a/xmlsecurity/source/framework/signatureengine.hxx
+++ /dev/null
@@ -1,141 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * 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
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _SIGNATUREENGINE_HXX
-#define _SIGNATUREENGINE_HXX
-
-#include <com/sun/star/xml/crypto/sax/XReferenceResolvedListener.hpp>
-#include <com/sun/star/xml/crypto/sax/XReferenceResolvedBroadcaster.hpp>
-#include <com/sun/star/xml/crypto/sax/XReferenceCollector.hpp>
-#include <com/sun/star/xml/crypto/sax/XKeyCollector.hpp>
-#include <com/sun/star/xml/crypto/sax/XMissionTaker.hpp>
-#include <com/sun/star/xml/crypto/sax/XSAXEventKeeper.hpp>
-#include <com/sun/star/xml/crypto/XXMLSecurityContext.hpp>
-#include <com/sun/star/xml/crypto/XXMLSignature.hpp>
-#include <com/sun/star/xml/crypto/XUriBinding.hpp>
-#include <com/sun/star/io/XInputStream.hpp>
-
-#include <cppuhelper/implbase2.hxx>
-
-#include "securityengine.hxx"
-
-#ifndef INCLUDED_VECTOR
-#include <vector>
-#define INCLUDED_VECTOR
-#endif
-
-class SignatureEngine : public cppu::ImplInheritanceHelper2
-<
- SecurityEngine,
- com::sun::star::xml::crypto::sax::XReferenceCollector,
- com::sun::star::xml::crypto::XUriBinding
->
-/****** signatureengine.hxx/CLASS SignatureEngine *****************************
- *
- * NAME
- * SignatureEngine -- Base class of SignatureCreator and SignatureVerifier
- *
- * FUNCTION
- * Maintains common members and methods related with signature operation.
- *
- * AUTHOR
- * Michael Mi
- * Email: michael.mi@sun.com
- ******************************************************************************/
-{
-protected:
-
- /*
- * the Signature bridge component, which performs signature generation
- * and verification based on xmlsec library.
- */
- com::sun::star::uno::Reference<
- com::sun::star::xml::crypto::XXMLSignature > m_xXMLSignature;
-
- /*
- * a collection of ElementCollector's ids. Each ElementCollector
- * represents one element signed by this signature.
- */
- std::vector< sal_Int32 > m_vReferenceIds;
-
- /*
- * remembers how many references this signature has.
- */
- sal_Int32 m_nTotalReferenceNumber;
-
- /*
- * a collection of Uri binding.
- *
- * the m_vUris is used to hold the Uri strings, and the m_vXInputStreams is used
- * to hold corresponding binded XInputStream interface.
- */
- std::vector< rtl::OUString > m_vUris;
- std::vector< com::sun::star::uno::Reference<
- com::sun::star::io::XInputStream > > m_vXInputStreams;
-
-protected:
- SignatureEngine( );
- virtual ~SignatureEngine() {};
-
- virtual void tryToPerform( )
- throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException);
- virtual void clearUp( ) const;
- virtual bool checkReady() const;
-
- /*
- * starts the main function. This method will be implemented by any sub-class.
- * For a SignatureCreator, it performs signing operation;
- * for a SignatureVerifier, verification operation is performed.
- */
- virtual void startEngine( const com::sun::star::uno::Reference<
- com::sun::star::xml::crypto::XXMLSignatureTemplate >&)
- throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException)
- {};
-
-public:
- /* XReferenceCollector */
- virtual void SAL_CALL setReferenceCount( sal_Int32 count )
- throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException);
-
- virtual void SAL_CALL setReferenceId( sal_Int32 id )
- throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException);
-
- /* XUriBinding */
- virtual void SAL_CALL setUriBinding(
- const rtl::OUString& uri,
- const com::sun::star::uno::Reference<
- com::sun::star::io::XInputStream >& aInputStream )
- throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException);
- virtual com::sun::star::uno::Reference< com::sun::star::io::XInputStream >
- SAL_CALL getUriBinding( const rtl::OUString& uri )
- throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException);
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmlsecurity/source/framework/signatureverifierimpl.cxx b/xmlsecurity/source/framework/signatureverifierimpl.cxx
deleted file mode 100644
index ae2b73d20..000000000
--- a/xmlsecurity/source/framework/signatureverifierimpl.cxx
+++ /dev/null
@@ -1,235 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * 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
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_xmlsecurity.hxx"
-
-#include "signatureverifierimpl.hxx"
-#include <com/sun/star/xml/crypto/XXMLSignatureTemplate.hpp>
-#include <com/sun/star/xml/wrapper/XXMLElementWrapper.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-
-namespace cssu = com::sun::star::uno;
-namespace cssl = com::sun::star::lang;
-namespace cssxc = com::sun::star::xml::crypto;
-namespace cssxw = com::sun::star::xml::wrapper;
-
-#define SERVICE_NAME "com.sun.star.xml.crypto.sax.SignatureVerifier"
-#define IMPLEMENTATION_NAME "com.sun.star.xml.security.framework.SignatureVerifierImpl"
-
-#define DECLARE_ASCII( SASCIIVALUE ) \
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SASCIIVALUE ) )
-
-SignatureVerifierImpl::SignatureVerifierImpl( const cssu::Reference< cssl::XMultiServiceFactory >& rxMSF)
-{
- mxMSF = rxMSF;
-}
-
-SignatureVerifierImpl::~SignatureVerifierImpl()
-{
-}
-
-bool SignatureVerifierImpl::checkReady() const
-/****** SignatureVerifierImpl/checkReady *************************************
- *
- * NAME
- * checkReady -- checks the conditions for the signature verification.
- *
- * SYNOPSIS
- * bReady = checkReady( );
- *
- * FUNCTION
- * checks whether all following conditions are satisfied:
- * 1. the result listener is ready;
- * 2. the SignatureEngine is ready.
- *
- * INPUTS
- * empty
- *
- * RESULT
- * bReady - true if all conditions are satisfied, false otherwise
- *
- * AUTHOR
- * Michael Mi
- * Email: michael.mi@sun.com
- ******************************************************************************/
-{
- return (m_xResultListener.is() && SignatureEngine::checkReady());
-}
-
-void SignatureVerifierImpl::notifyResultListener() const
- throw (cssu::Exception, cssu::RuntimeException)
-/****** SignatureVerifierImpl/notifyResultListener ***************************
- *
- * NAME
- * notifyResultListener -- notifies the listener about the verify result.
- *
- * SYNOPSIS
- * notifyResultListener( );
- *
- * FUNCTION
- * see NAME.
- *
- * INPUTS
- * empty
- *
- * RESULT
- * empty
- *
- * AUTHOR
- * Michael Mi
- * Email: michael.mi@sun.com
- ******************************************************************************/
-{
- cssu::Reference< cssxc::sax::XSignatureVerifyResultListener >
- xSignatureVerifyResultListener ( m_xResultListener , cssu::UNO_QUERY ) ;
-
- xSignatureVerifyResultListener->signatureVerified( m_nSecurityId, m_nStatus );
-}
-
-void SignatureVerifierImpl::startEngine( const cssu::Reference<
- cssxc::XXMLSignatureTemplate >&
- xSignatureTemplate)
- throw (cssu::Exception, cssu::RuntimeException)
-/****** SignatureVerifierImpl/startEngine ************************************
- *
- * NAME
- * startEngine -- verifies the signature.
- *
- * SYNOPSIS
- * startEngine( xSignatureTemplate );
- *
- * FUNCTION
- * see NAME.
- *
- * INPUTS
- * xSignatureTemplate - the signature template (along with all referenced
- * elements) to be verified.
- *
- * RESULT
- * empty
- *
- * AUTHOR
- * Michael Mi
- * Email: michael.mi@sun.com
- ******************************************************************************/
-{
- cssu::Reference< cssxc::XXMLSignatureTemplate > xResultTemplate;
- try
- {
- xResultTemplate = m_xXMLSignature->validate(xSignatureTemplate, m_xXMLSecurityContext);
- m_nStatus = xResultTemplate->getStatus();
- }
- catch( cssu::Exception& )
- {
- m_nStatus = cssxc::SecurityOperationStatus_RUNTIMEERROR_FAILED;
- }
-}
-
-/* XSignatureVerifyResultBroadcaster */
-void SAL_CALL SignatureVerifierImpl::addSignatureVerifyResultListener(
- const cssu::Reference< cssxc::sax::XSignatureVerifyResultListener >& listener )
- throw (cssu::Exception, cssu::RuntimeException)
-{
- m_xResultListener = listener;
- tryToPerform();
-}
-
-void SAL_CALL SignatureVerifierImpl::removeSignatureVerifyResultListener(
- const cssu::Reference< cssxc::sax::XSignatureVerifyResultListener >&)
- throw (cssu::RuntimeException)
-{
-}
-
-/* XInitialization */
-void SAL_CALL SignatureVerifierImpl::initialize(
- const cssu::Sequence< cssu::Any >& aArguments )
- throw (cssu::Exception, cssu::RuntimeException)
-{
- OSL_ASSERT(aArguments.getLength() == 5);
-
- rtl::OUString ouTempString;
-
- aArguments[0] >>= ouTempString;
- m_nSecurityId = ouTempString.toInt32();
- aArguments[1] >>= m_xSAXEventKeeper;
- aArguments[2] >>= ouTempString;
- m_nIdOfTemplateEC = ouTempString.toInt32();
- aArguments[3] >>= m_xXMLSecurityContext;
- aArguments[4] >>= m_xXMLSignature;
-}
-
-
-rtl::OUString SignatureVerifierImpl_getImplementationName ()
- throw (cssu::RuntimeException)
-{
- return rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM ( IMPLEMENTATION_NAME ) );
-}
-
-sal_Bool SAL_CALL SignatureVerifierImpl_supportsService( const rtl::OUString& ServiceName )
- throw (cssu::RuntimeException)
-{
- return ServiceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM ( SERVICE_NAME ));
-}
-
-cssu::Sequence< rtl::OUString > SAL_CALL SignatureVerifierImpl_getSupportedServiceNames( )
- throw (cssu::RuntimeException)
-{
- cssu::Sequence < rtl::OUString > aRet(1);
- rtl::OUString* pArray = aRet.getArray();
- pArray[0] = rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM ( SERVICE_NAME ) );
- return aRet;
-}
-#undef SERVICE_NAME
-
-cssu::Reference< cssu::XInterface > SAL_CALL SignatureVerifierImpl_createInstance(
- const cssu::Reference< cssl::XMultiServiceFactory >& rSMgr)
- throw( cssu::Exception )
-{
- return (cppu::OWeakObject*) new SignatureVerifierImpl(rSMgr);
-}
-
-/* XServiceInfo */
-rtl::OUString SAL_CALL SignatureVerifierImpl::getImplementationName( )
- throw (cssu::RuntimeException)
-{
- return SignatureVerifierImpl_getImplementationName();
-}
-sal_Bool SAL_CALL SignatureVerifierImpl::supportsService( const rtl::OUString& rServiceName )
- throw (cssu::RuntimeException)
-{
- return SignatureVerifierImpl_supportsService( rServiceName );
-}
-cssu::Sequence< rtl::OUString > SAL_CALL SignatureVerifierImpl::getSupportedServiceNames( )
- throw (cssu::RuntimeException)
-{
- return SignatureVerifierImpl_getSupportedServiceNames();
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmlsecurity/source/framework/signatureverifierimpl.hxx b/xmlsecurity/source/framework/signatureverifierimpl.hxx
deleted file mode 100644
index 26dc7865c..000000000
--- a/xmlsecurity/source/framework/signatureverifierimpl.hxx
+++ /dev/null
@@ -1,133 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * 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
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _SIGNATUREVERIFIERIMPL_HXX
-#define _SIGNATUREVERIFIERIMPL_HXX
-
-#include <com/sun/star/xml/crypto/sax/XSignatureVerifyResultListener.hpp>
-#include <com/sun/star/xml/crypto/sax/XSignatureVerifyResultBroadcaster.hpp>
-#include <com/sun/star/xml/crypto/XXMLSecurityContext.hpp>
-#include <com/sun/star/lang/XInitialization.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <cppuhelper/implbase3.hxx>
-
-#include "signatureengine.hxx"
-
-class SignatureVerifierImpl : public cppu::ImplInheritanceHelper3
-<
- SignatureEngine,
- com::sun::star::xml::crypto::sax::XSignatureVerifyResultBroadcaster,
- com::sun::star::lang::XInitialization,
- com::sun::star::lang::XServiceInfo
->
-/****** SignatureVerifier.hxx/CLASS SignatureVerifierImpl *********************
- *
- * NAME
- * SignatureVerifierImpl -- verifies a signature
- *
- * FUNCTION
- * Collects all resources for a signature verification, then verifies the
- * signature by invoking a xmlsec-based signature bridge component.
- *
- * AUTHOR
- * Michael Mi
- * Email: michael.mi@sun.com
- ******************************************************************************/
-{
-private:
- /*
- * the Id of the signature, which is used for the result listener to
- * identify the signature.
- */
- sal_Int32 m_nSignatureId;
-
- /*
- * the verify result
- */
- bool m_bVerifySucceed;
-
- com::sun::star::uno::Reference<
- com::sun::star::xml::crypto::XXMLSecurityContext > m_xXMLSecurityContext;
-
- virtual void notifyResultListener() const
- throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException);
- virtual bool checkReady() const;
- virtual void startEngine( const com::sun::star::uno::Reference<
- com::sun::star::xml::crypto::XXMLSignatureTemplate >&
- xSignatureTemplate)
- throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException);
-
-public:
- explicit SignatureVerifierImpl( const com::sun::star::uno::Reference<
- com::sun::star::lang::XMultiServiceFactory >& rxMSF);
- virtual ~SignatureVerifierImpl();
-
- /* XSignatureVerifyResultBroadcaster */
- virtual void SAL_CALL addSignatureVerifyResultListener(
- const com::sun::star::uno::Reference<
- com::sun::star::xml::crypto::sax::XSignatureVerifyResultListener >&
- listener )
- throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeSignatureVerifyResultListener(
- const com::sun::star::uno::Reference<
- com::sun::star::xml::crypto::sax::XSignatureVerifyResultListener >&
- listener )
- throw (com::sun::star::uno::RuntimeException);
-
- /* XInitialization */
- virtual void SAL_CALL initialize(
- const com::sun::star::uno::Sequence< com::sun::star::uno::Any >& aArguments )
- throw (com::sun::star::uno::Exception, com::sun::star::uno::RuntimeException);
-
- /* XServiceInfo */
- virtual rtl::OUString SAL_CALL getImplementationName( )
- throw (com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsService( const rtl::OUString& ServiceName )
- throw (com::sun::star::uno::RuntimeException);
- virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getSupportedServiceNames( )
- throw (com::sun::star::uno::RuntimeException);
-};
-
-rtl::OUString SignatureVerifierImpl_getImplementationName()
- throw ( com::sun::star::uno::RuntimeException );
-
-sal_Bool SAL_CALL SignatureVerifierImpl_supportsService( const rtl::OUString& ServiceName )
- throw ( com::sun::star::uno::RuntimeException );
-
-com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL SignatureVerifierImpl_getSupportedServiceNames( )
- throw ( com::sun::star::uno::RuntimeException );
-
-com::sun::star::uno::Reference< com::sun::star::uno::XInterface >
-SAL_CALL SignatureVerifierImpl_createInstance(
- const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > & rSMgr)
- throw ( com::sun::star::uno::Exception );
-
-#endif
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmlsecurity/source/framework/xmlencryptiontemplateimpl.cxx b/xmlsecurity/source/framework/xmlencryptiontemplateimpl.cxx
deleted file mode 100644
index 243d4dc7c..000000000
--- a/xmlsecurity/source/framework/xmlencryptiontemplateimpl.cxx
+++ /dev/null
@@ -1,141 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * 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
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_xmlsecurity.hxx"
-#include <sal/config.h>
-#include <rtl/uuid.h>
-#include "xmlencryptiontemplateimpl.hxx"
-
-using namespace ::com::sun::star::uno ;
-using ::com::sun::star::lang::XMultiServiceFactory ;
-using ::com::sun::star::lang::XSingleServiceFactory ;
-using ::rtl::OUString ;
-
-using ::com::sun::star::xml::wrapper::XXMLElementWrapper ;
-using ::com::sun::star::xml::crypto::XXMLEncryptionTemplate ;
-
-XMLEncryptionTemplateImpl :: XMLEncryptionTemplateImpl( const Reference< XMultiServiceFactory >& aFactory )
- : m_xTemplate( NULL ),
- m_xTarget( NULL ),
- m_xServiceManager( aFactory ),
- m_nStatus ( ::com::sun::star::xml::crypto::SecurityOperationStatus_UNKNOWN ) {
-}
-
-XMLEncryptionTemplateImpl :: ~XMLEncryptionTemplateImpl() {
-}
-
-/* XXMLEncryptionTemplate */
-void SAL_CALL XMLEncryptionTemplateImpl :: setTemplate( const Reference< XXMLElementWrapper >& aTemplate )
- throw (com::sun::star::uno::RuntimeException, com::sun::star::lang::IllegalArgumentException)
-{
- m_xTemplate = aTemplate ;
-}
-
-/* XXMLEncryptionTemplate */
-Reference< XXMLElementWrapper > SAL_CALL XMLEncryptionTemplateImpl :: getTemplate()
-throw (com::sun::star::uno::RuntimeException)
-{
- return m_xTemplate ;
-}
-
-/* XXMLEncryptionTemplate */
-void SAL_CALL XMLEncryptionTemplateImpl :: setTarget( const Reference< XXMLElementWrapper >& aTarget )
- throw( com::sun::star::lang::IllegalArgumentException ) {
- m_xTarget = aTarget ;
-}
-
-/* XXMLEncryptionTemplate */
-Reference< XXMLElementWrapper > SAL_CALL XMLEncryptionTemplateImpl :: getTarget()
-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
-} ;
-
-/* XServiceInfo */
-OUString SAL_CALL XMLEncryptionTemplateImpl :: getImplementationName() throw( RuntimeException ) {
- return impl_getImplementationName() ;
-}
-
-/* XServiceInfo */
-sal_Bool SAL_CALL XMLEncryptionTemplateImpl :: supportsService( const OUString& serviceName) throw( RuntimeException ) {
- Sequence< OUString > seqServiceNames = getSupportedServiceNames() ;
- const OUString* pArray = seqServiceNames.getConstArray() ;
- for( sal_Int32 i = 0 ; i < seqServiceNames.getLength() ; i ++ ) {
- if( *( pArray + i ) == serviceName )
- return sal_True ;
- }
- return sal_False ;
-}
-
-/* XServiceInfo */
-Sequence< OUString > SAL_CALL XMLEncryptionTemplateImpl :: getSupportedServiceNames() throw( RuntimeException ) {
- return impl_getSupportedServiceNames() ;
-}
-
-//Helper for XServiceInfo
-Sequence< OUString > XMLEncryptionTemplateImpl :: impl_getSupportedServiceNames() {
- ::osl::Guard< ::osl::Mutex > aGuard( ::osl::Mutex::getGlobalMutex() ) ;
- Sequence< OUString > seqServiceNames( 1 ) ;
- seqServiceNames.getArray()[0] = OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.crypto.XMLEncryptionTemplate")) ;
- return seqServiceNames ;
-}
-
-OUString XMLEncryptionTemplateImpl :: impl_getImplementationName() throw( RuntimeException ) {
- return OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.security.framework.XMLEncryptionTemplateImpl")) ;
-}
-
-//Helper for registry
-Reference< XInterface > SAL_CALL XMLEncryptionTemplateImpl :: impl_createInstance( const Reference< XMultiServiceFactory >& aServiceManager ) throw( RuntimeException ) {
- return Reference< XInterface >( *new XMLEncryptionTemplateImpl( aServiceManager ) ) ;
-}
-
-Reference< XSingleServiceFactory > XMLEncryptionTemplateImpl :: impl_createFactory( const Reference< XMultiServiceFactory >& aServiceManager ) {
- return ::cppu::createSingleFactory( aServiceManager , impl_getImplementationName() , impl_createInstance , impl_getSupportedServiceNames() ) ;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmlsecurity/source/framework/xmlencryptiontemplateimpl.hxx b/xmlsecurity/source/framework/xmlencryptiontemplateimpl.hxx
deleted file mode 100644
index 10b33c8a5..000000000
--- a/xmlsecurity/source/framework/xmlencryptiontemplateimpl.hxx
+++ /dev/null
@@ -1,112 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * 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
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _XMLENCRYPTIONTEMPLATEIMPL_HXX_
-#define _XMLENCRYPTIONTEMPLATEIMPL_HXX_
-
-#include <sal/config.h>
-#include <rtl/ustring.hxx>
-#include <cppuhelper/factory.hxx>
-#include <cppuhelper/implbase3.hxx>
-#include <com/sun/star/uno/Exception.hpp>
-
-#include <com/sun/star/uno/Reference.hxx>
-#include <com/sun/star/lang/XSingleServiceFactory.hpp>
-
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/lang/XInitialization.hpp>
-#include <com/sun/star/lang/XUnoTunnel.hpp>
-#include <com/sun/star/xml/crypto/XXMLEncryptionTemplate.hpp>
-#include <com/sun/star/xml/wrapper/XXMLElementWrapper.hpp>
-
-class XMLEncryptionTemplateImpl : public ::cppu::WeakImplHelper3<
- ::com::sun::star::xml::crypto::XXMLEncryptionTemplate ,
- ::com::sun::star::lang::XInitialization ,
- ::com::sun::star::lang::XServiceInfo >
-{
- private :
- ::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 ) ;
- virtual ~XMLEncryptionTemplateImpl() ;
-
- //Methods from XXMLEncryptionTemplate
- virtual void SAL_CALL setTemplate(
- const ::com::sun::star::uno::Reference< ::com::sun::star::xml::wrapper::XXMLElementWrapper >& aXmlElement
- )
- throw (com::sun::star::uno::RuntimeException, com::sun::star::lang::IllegalArgumentException);
-
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::wrapper::XXMLElementWrapper > SAL_CALL getTemplate(
- ) throw (com::sun::star::uno::RuntimeException);
-
- virtual void SAL_CALL setTarget(
- const ::com::sun::star::uno::Reference< ::com::sun::star::xml::wrapper::XXMLElementWrapper >& aXmlElement
- ) throw( com::sun::star::lang::IllegalArgumentException);
-
- 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
- ) throw( ::com::sun::star::uno::Exception , ::com::sun::star::uno::RuntimeException ) ;
-
- //Methods from XServiceInfo
- virtual ::rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException ) ;
-
- virtual sal_Bool SAL_CALL supportsService(
- const ::rtl::OUString& ServiceName
- ) throw( ::com::sun::star::uno::RuntimeException ) ;
-
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException ) ;
-
- //Helper for XServiceInfo
- static ::com::sun::star::uno::Sequence< ::rtl::OUString > impl_getSupportedServiceNames() ;
-
- static ::rtl::OUString impl_getImplementationName() throw( ::com::sun::star::uno::RuntimeException ) ;
-
- //Helper for registry
- static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL impl_createInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& aServiceManager ) throw( ::com::sun::star::uno::RuntimeException ) ;
-
- 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 ) ;
-} ;
-
-#endif // _XMLENCRYPTIONTEMPLATE_XMLSECIMPL_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmlsecurity/source/framework/xmlsignaturetemplateimpl.cxx b/xmlsecurity/source/framework/xmlsignaturetemplateimpl.cxx
deleted file mode 100644
index c4358d645..000000000
--- a/xmlsecurity/source/framework/xmlsignaturetemplateimpl.cxx
+++ /dev/null
@@ -1,166 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * 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
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_xmlsecurity.hxx"
-#include <sal/config.h>
-#include <rtl/ustring.hxx>
-#include <rtl/uuid.h>
-#include "xmlsignaturetemplateimpl.hxx"
-
-using namespace ::com::sun::star::uno ;
-using ::com::sun::star::lang::XMultiServiceFactory ;
-using ::com::sun::star::lang::XSingleServiceFactory ;
-using ::rtl::OUString ;
-
-using ::com::sun::star::xml::wrapper::XXMLElementWrapper ;
-using ::com::sun::star::xml::crypto::XXMLSignatureTemplate ;
-
-XMLSignatureTemplateImpl :: XMLSignatureTemplateImpl( const Reference< XMultiServiceFactory >& aFactory )
- :m_xTemplate( NULL ),
- m_xServiceManager( aFactory ),
- m_nStatus ( ::com::sun::star::xml::crypto::SecurityOperationStatus_UNKNOWN )
-{
-}
-
-XMLSignatureTemplateImpl :: ~XMLSignatureTemplateImpl() {
-}
-
-/* XXMLSignatureTemplate */
-void SAL_CALL XMLSignatureTemplateImpl :: setTemplate( const Reference< XXMLElementWrapper >& aTemplate )
- throw( com::sun::star::uno::RuntimeException, com::sun::star::lang::IllegalArgumentException)
-{
- m_xTemplate = aTemplate ;
-}
-
-/* XXMLSignatureTemplate */
-Reference< XXMLElementWrapper > SAL_CALL XMLSignatureTemplateImpl :: getTemplate()
- throw (com::sun::star::uno::RuntimeException)
-{
- return m_xTemplate ;
-}
-
-void SAL_CALL XMLSignatureTemplateImpl :: setTarget( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::wrapper::XXMLElementWrapper >& aXmlElement )
- throw( com::sun::star::uno::RuntimeException, com::sun::star::lang::IllegalArgumentException)
-{
- targets.push_back( aXmlElement );
-}
-
-::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::xml::wrapper::XXMLElementWrapper > > SAL_CALL XMLSignatureTemplateImpl :: getTargets()
- throw (com::sun::star::uno::RuntimeException)
-{
- sal_Int32 length = targets.size();
- ::com::sun::star::uno::Sequence<
- ::com::sun::star::uno::Reference< ::com::sun::star::xml::wrapper::XXMLElementWrapper >
- > aTargets (length);
-
- sal_Int32 i;
-
- for (i=0; i<length; i++)
- {
- aTargets[i] = targets[i];
- }
-
- return aTargets;
-}
-
-void SAL_CALL XMLSignatureTemplateImpl::setBinding(
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::xml::crypto::XUriBinding >& aUriBinding )
- throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
-{
- m_xUriBinding = aUriBinding;
-}
-
-::com::sun::star::uno::Reference< ::com::sun::star::xml::crypto::XUriBinding > SAL_CALL XMLSignatureTemplateImpl::getBinding()
- throw (::com::sun::star::uno::RuntimeException)
-{
- 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
-} ;
-
-/* XServiceInfo */
-OUString SAL_CALL XMLSignatureTemplateImpl :: getImplementationName() throw( RuntimeException ) {
- return impl_getImplementationName() ;
-}
-
-/* XServiceInfo */
-sal_Bool SAL_CALL XMLSignatureTemplateImpl :: supportsService( const OUString& serviceName) throw( RuntimeException ) {
- Sequence< OUString > seqServiceNames = getSupportedServiceNames() ;
- const OUString* pArray = seqServiceNames.getConstArray() ;
- for( sal_Int32 i = 0 ; i < seqServiceNames.getLength() ; i ++ ) {
- if( *( pArray + i ) == serviceName )
- return sal_True ;
- }
- return sal_False ;
-}
-
-/* XServiceInfo */
-Sequence< OUString > SAL_CALL XMLSignatureTemplateImpl :: getSupportedServiceNames() throw( RuntimeException ) {
- return impl_getSupportedServiceNames() ;
-}
-
-//Helper for XServiceInfo
-Sequence< OUString > XMLSignatureTemplateImpl :: impl_getSupportedServiceNames() {
- ::osl::Guard< ::osl::Mutex > aGuard( ::osl::Mutex::getGlobalMutex() ) ;
- Sequence< OUString > seqServiceNames( 1 ) ;
- seqServiceNames.getArray()[0] = OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.crypto.XMLSignatureTemplate")) ;
- return seqServiceNames ;
-}
-
-OUString XMLSignatureTemplateImpl :: impl_getImplementationName() throw( RuntimeException ) {
- return OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.xml.security.framework.XMLSignatureTemplateImpl")) ;
-}
-
-//Helper for registry
-Reference< XInterface > SAL_CALL XMLSignatureTemplateImpl :: impl_createInstance( const Reference< XMultiServiceFactory >& aServiceManager ) throw( RuntimeException ) {
- return Reference< XInterface >( *new XMLSignatureTemplateImpl( aServiceManager ) ) ;
-}
-
-Reference< XSingleServiceFactory > XMLSignatureTemplateImpl :: impl_createFactory( const Reference< XMultiServiceFactory >& aServiceManager ) {
- return ::cppu::createSingleFactory( aServiceManager , impl_getImplementationName() , impl_createInstance , impl_getSupportedServiceNames() ) ;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmlsecurity/source/framework/xmlsignaturetemplateimpl.hxx b/xmlsecurity/source/framework/xmlsignaturetemplateimpl.hxx
deleted file mode 100644
index 76b3ac62e..000000000
--- a/xmlsecurity/source/framework/xmlsignaturetemplateimpl.hxx
+++ /dev/null
@@ -1,122 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * 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
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _XMLSIGNATURETEMPLATEIMPL_HXX_
-#define _XMLSIGNATURETEMPLATEIMPL_HXX_
-
-#include <sal/config.h>
-#include <rtl/ustring.hxx>
-#include <cppuhelper/factory.hxx>
-#include <cppuhelper/implbase3.hxx>
-#include <com/sun/star/uno/Exception.hpp>
-
-#include <com/sun/star/uno/Reference.hxx>
-#include <com/sun/star/lang/XSingleServiceFactory.hpp>
-
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/lang/XInitialization.hpp>
-#include <com/sun/star/xml/crypto/XXMLSignatureTemplate.hpp>
-#include <com/sun/star/xml/wrapper/XXMLElementWrapper.hpp>
-
-#include <vector>
-
-class XMLSignatureTemplateImpl : public ::cppu::WeakImplHelper3<
- ::com::sun::star::xml::crypto::XXMLSignatureTemplate ,
- ::com::sun::star::lang::XInitialization ,
- ::com::sun::star::lang::XServiceInfo >
-{
- private :
- ::com::sun::star::uno::Reference< ::com::sun::star::xml::wrapper::XXMLElementWrapper > m_xTemplate ;
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xServiceManager ;
- std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::xml::wrapper::XXMLElementWrapper > > targets;
- ::com::sun::star::uno::Reference< ::com::sun::star::xml::crypto::XUriBinding > m_xUriBinding;
- ::com::sun::star::xml::crypto::SecurityOperationStatus m_nStatus;
-
- public :
- XMLSignatureTemplateImpl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& aFactory ) ;
- virtual ~XMLSignatureTemplateImpl() ;
-
- //Methods from XXMLSignatureTemplate
- virtual void SAL_CALL setTemplate(
- const ::com::sun::star::uno::Reference< ::com::sun::star::xml::wrapper::XXMLElementWrapper >& aXmlElement
- ) throw( com::sun::star::uno::RuntimeException, com::sun::star::lang::IllegalArgumentException);
-
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::wrapper::XXMLElementWrapper > SAL_CALL getTemplate(
- ) throw (com::sun::star::uno::RuntimeException);
-
- virtual void SAL_CALL setTarget(
- const ::com::sun::star::uno::Reference< ::com::sun::star::xml::wrapper::XXMLElementWrapper >& aXmlElement
- ) throw( com::sun::star::uno::RuntimeException, com::sun::star::lang::IllegalArgumentException);
-
- virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::xml::wrapper::XXMLElementWrapper > > SAL_CALL getTargets(
- ) throw (com::sun::star::uno::RuntimeException);
-
- virtual void SAL_CALL setBinding(
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::xml::crypto::XUriBinding >& aUriBinding )
- throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference<
- ::com::sun::star::xml::crypto::XUriBinding >
- SAL_CALL getBinding( )
- 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
- ) throw( ::com::sun::star::uno::Exception , ::com::sun::star::uno::RuntimeException ) ;
-
- //Methods from XServiceInfo
- virtual ::rtl::OUString SAL_CALL getImplementationName() throw( ::com::sun::star::uno::RuntimeException ) ;
-
- virtual sal_Bool SAL_CALL supportsService(
- const ::rtl::OUString& ServiceName
- ) throw( ::com::sun::star::uno::RuntimeException ) ;
-
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw( ::com::sun::star::uno::RuntimeException ) ;
-
- //Helper for XServiceInfo
- static ::com::sun::star::uno::Sequence< ::rtl::OUString > impl_getSupportedServiceNames() ;
-
- static ::rtl::OUString impl_getImplementationName() throw( ::com::sun::star::uno::RuntimeException ) ;
-
- //Helper for registry
- static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL impl_createInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& aServiceManager ) throw( ::com::sun::star::uno::RuntimeException ) ;
-
- 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 ) ;
-} ;
-
-#endif // _XMLSIGNATURETEMPLATE_XMLSECIMPL_HXX_
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/xmlsecurity/source/framework/xsec_framework.cxx b/xmlsecurity/source/framework/xsec_framework.cxx
deleted file mode 100644
index 897ac7213..000000000
--- a/xmlsecurity/source/framework/xsec_framework.cxx
+++ /dev/null
@@ -1,168 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * 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
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_xmlsecurity.hxx"
-
-#include <stdio.h>
-
-#include <osl/mutex.hxx>
-#include <osl/thread.h>
-#include <cppuhelper/factory.hxx>
-#include <com/sun/star/lang/XSingleServiceFactory.hpp>
-
-#include <decryptorimpl.hxx>
-#include <encryptorimpl.hxx>
-#include <signaturecreatorimpl.hxx>
-#include <signatureverifierimpl.hxx>
-#include <saxeventkeeperimpl.hxx>
-#include <xmlencryptiontemplateimpl.hxx>
-#include <xmlsignaturetemplateimpl.hxx>
-
-using namespace ::rtl;
-using namespace ::cppu;
-using namespace ::com::sun::star::uno;
-using namespace ::com::sun::star::lang;
-using namespace ::com::sun::star::registry;
-
-extern "C"
-{
-//==================================================================================================
-SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory(
- const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ )
-{
- void * pRet = 0;
-
- //Decryptor
- OUString implName = OUString::createFromAscii( pImplName );
- if ( pServiceManager && implName.equals(DecryptorImpl_getImplementationName()) )
- {
- Reference< XSingleServiceFactory > xFactory( createSingleFactory(
- reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
- OUString::createFromAscii( pImplName ),
- DecryptorImpl_createInstance, DecryptorImpl_getSupportedServiceNames() ) );
-
- if (xFactory.is())
- {
- xFactory->acquire();
- pRet = xFactory.get();
- }
- }
-
- //Encryptor
- if ( pServiceManager && implName.equals(EncryptorImpl_getImplementationName()) )
- {
- Reference< XSingleServiceFactory > xFactory( createSingleFactory(
- reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
- OUString::createFromAscii( pImplName ),
- EncryptorImpl_createInstance, EncryptorImpl_getSupportedServiceNames() ) );
-
- if (xFactory.is())
- {
- xFactory->acquire();
- pRet = xFactory.get();
- }
- }
-
- //SignatureCreator
- if ( pServiceManager && implName.equals(SignatureCreatorImpl_getImplementationName()) )
- {
- Reference< XSingleServiceFactory > xFactory( createSingleFactory(
- reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
- OUString::createFromAscii( pImplName ),
- SignatureCreatorImpl_createInstance, SignatureCreatorImpl_getSupportedServiceNames() ) );
-
- if (xFactory.is())
- {
- xFactory->acquire();
- pRet = xFactory.get();
- }
- }
-
- //SignatureVerifier
- if ( pServiceManager && implName.equals(SignatureVerifierImpl_getImplementationName()) )
- {
- Reference< XSingleServiceFactory > xFactory( createSingleFactory(
- reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
- OUString::createFromAscii( pImplName ),
- SignatureVerifierImpl_createInstance, SignatureVerifierImpl_getSupportedServiceNames() ) );
-
- if (xFactory.is())
- {
- xFactory->acquire();
- pRet = xFactory.get();
- }
- }
-
- //SAXEventKeeper
- if ( pServiceManager && implName.equals(SAXEventKeeperImpl_getImplementationName()) )
- {
- Reference< XSingleServiceFactory > xFactory( createSingleFactory(
- reinterpret_cast< XMultiServiceFactory * >( pServiceManager ),
- OUString::createFromAscii( pImplName ),
- SAXEventKeeperImpl_createInstance, SAXEventKeeperImpl_getSupportedServiceNames() ) );
-
- if (xFactory.is())
- {
- xFactory->acquire();
- pRet = xFactory.get();
- }
- }
-
- //XMLSignatureTemplate
- if ( pServiceManager && implName.equals( XMLSignatureTemplateImpl::impl_getImplementationName()) )
- {
- Reference< XSingleServiceFactory > xFactory = XMLSignatureTemplateImpl::impl_createFactory(
- reinterpret_cast< XMultiServiceFactory* >( pServiceManager ) ) ;
-
- if (xFactory.is())
- {
- xFactory->acquire();
- pRet = xFactory.get();
- }
- }
-
- //XMLEncryptionTemplate
- if ( pServiceManager && implName.equals( XMLEncryptionTemplateImpl::impl_getImplementationName()) )
- {
- Reference< XSingleServiceFactory > xFactory = XMLEncryptionTemplateImpl::impl_createFactory(
- reinterpret_cast< XMultiServiceFactory* >( pServiceManager ) ) ;
-
- if (xFactory.is())
- {
- xFactory->acquire();
- pRet = xFactory.get();
- }
- }
-
- return pRet;
-}
-}
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */