summaryrefslogtreecommitdiff
path: root/xmlsecurity
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2016-02-09 12:10:46 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-02-09 13:34:18 +0100
commit4dcee42b44f56fec0b90ee6f7edcaaaa87adecdc (patch)
tree050f110c5dfed97de6afe955e538f9e2b0e9c4f9 /xmlsecurity
parent0163501d57725b01037248922949029077b37530 (diff)
xmlsecurity: mark the Signature, not the SignedInfo during OOXML export
So that we pass the correct node to xmlSecDSigCtxSign(). SAXEventKeeperImpl::startElement() always marks the first node written by XSecController, which is the Signature node for ODF, but for OOXML, the Signature node is the root element. Fix the problem by writing the root element in XSecController::exportOOXMLSignature() instead of doing it earlier, similar how it's done for ODF (where we intentionally want to not mark the root node). Change-Id: Id0a76f155726ad53a996e9327454b8795497ac7b
Diffstat (limited to 'xmlsecurity')
-rw-r--r--xmlsecurity/source/helper/xmlsignaturehelper.cxx6
-rw-r--r--xmlsecurity/source/helper/xsecctl.cxx7
2 files changed, 7 insertions, 6 deletions
diff --git a/xmlsecurity/source/helper/xmlsignaturehelper.cxx b/xmlsecurity/source/helper/xmlsignaturehelper.cxx
index f65324819fbd..bf80548b9d59 100644
--- a/xmlsecurity/source/helper/xmlsignaturehelper.cxx
+++ b/xmlsecurity/source/helper/xmlsignaturehelper.cxx
@@ -500,17 +500,11 @@ bool XMLSignatureHelper::CreateAndWriteOOXMLSignature(css::uno::Reference<css::e
xSaxWriter->setOutputStream(xOutputStream);
xSaxWriter->startDocument();
- SvXMLAttributeList* pAttributeList = new SvXMLAttributeList();
- pAttributeList->AddAttribute(ATTR_XMLNS, NS_XMLDSIG);
- pAttributeList->AddAttribute(ATTR_ID, "idPackageSignature");
- xSaxWriter->startElement(TAG_SIGNATURE, uno::Reference<xml::sax::XAttributeList>(pAttributeList));
-
mbError = false;
uno::Reference<xml::sax::XDocumentHandler> xDocumentHandler(xSaxWriter, uno::UNO_QUERY);
if (!mpXSecController->WriteOOXMLSignature(xDocumentHandler))
mbError = true;
- xSaxWriter->endElement(TAG_SIGNATURE);
xSaxWriter->endDocument();
return !mbError;
diff --git a/xmlsecurity/source/helper/xsecctl.cxx b/xmlsecurity/source/helper/xsecctl.cxx
index 0cd17a966cd2..13c09af072da 100644
--- a/xmlsecurity/source/helper/xsecctl.cxx
+++ b/xmlsecurity/source/helper/xsecctl.cxx
@@ -995,6 +995,12 @@ static bool lcl_isOOXMLBlacklist(const OUString& rStreamName)
void XSecController::exportOOXMLSignature(const uno::Reference<xml::sax::XDocumentHandler>& xDocumentHandler, const SignatureInformation& rInformation)
{
+ {
+ rtl::Reference<SvXMLAttributeList> pAttributeList(new SvXMLAttributeList());
+ pAttributeList->AddAttribute(ATTR_XMLNS, NS_XMLDSIG);
+ pAttributeList->AddAttribute(ATTR_ID, "idPackageSignature");
+ xDocumentHandler->startElement(TAG_SIGNATURE, uno::Reference<xml::sax::XAttributeList>(pAttributeList.get()));
+ }
xDocumentHandler->startElement(TAG_SIGNEDINFO, uno::Reference<xml::sax::XAttributeList>(new SvXMLAttributeList()));
{
@@ -1104,6 +1110,7 @@ void XSecController::exportOOXMLSignature(const uno::Reference<xml::sax::XDocume
xDocumentHandler->startElement(TAG_OBJECT, uno::Reference<xml::sax::XAttributeList>(new SvXMLAttributeList()));
xDocumentHandler->endElement(TAG_OBJECT);
+ xDocumentHandler->endElement(TAG_SIGNATURE);
}
SignatureInformation XSecController::getSignatureInformation( sal_Int32 nSecurityId ) const