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::ReferencesetOutputStream(xOutputStream); xSaxWriter->startDocument(); - SvXMLAttributeList* pAttributeList = new SvXMLAttributeList(); - pAttributeList->AddAttribute(ATTR_XMLNS, NS_XMLDSIG); - pAttributeList->AddAttribute(ATTR_ID, "idPackageSignature"); - xSaxWriter->startElement(TAG_SIGNATURE, uno::Reference(pAttributeList)); - mbError = false; uno::Reference 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& xDocumentHandler, const SignatureInformation& rInformation) { + { + rtl::Reference pAttributeList(new SvXMLAttributeList()); + pAttributeList->AddAttribute(ATTR_XMLNS, NS_XMLDSIG); + pAttributeList->AddAttribute(ATTR_ID, "idPackageSignature"); + xDocumentHandler->startElement(TAG_SIGNATURE, uno::Reference(pAttributeList.get())); + } xDocumentHandler->startElement(TAG_SIGNEDINFO, uno::Reference(new SvXMLAttributeList())); { @@ -1104,6 +1110,7 @@ void XSecController::exportOOXMLSignature(const uno::ReferencestartElement(TAG_OBJECT, uno::Reference(new SvXMLAttributeList())); xDocumentHandler->endElement(TAG_OBJECT); + xDocumentHandler->endElement(TAG_SIGNATURE); } SignatureInformation XSecController::getSignatureInformation( sal_Int32 nSecurityId ) const