summaryrefslogtreecommitdiff
path: root/xmlsecurity
diff options
context:
space:
mode:
Diffstat (limited to 'xmlsecurity')
-rw-r--r--xmlsecurity/source/helper/xsecctl.cxx26
-rw-r--r--xmlsecurity/source/helper/xsecctl.hxx1
2 files changed, 26 insertions, 1 deletions
diff --git a/xmlsecurity/source/helper/xsecctl.cxx b/xmlsecurity/source/helper/xsecctl.cxx
index 81b8d97bcf59..cd1f7e35494a 100644
--- a/xmlsecurity/source/helper/xsecctl.cxx
+++ b/xmlsecurity/source/helper/xsecctl.cxx
@@ -975,7 +975,7 @@ void XSecController::exportSignature(
xDocumentHandler->endElement( tag_Signature );
}
-void XSecController::exportOOXMLSignature(const uno::Reference<xml::sax::XDocumentHandler>& xDocumentHandler, const SignatureInformation& /*rInformation*/)
+void XSecController::exportOOXMLSignature(const uno::Reference<xml::sax::XDocumentHandler>& xDocumentHandler, const SignatureInformation& rInformation)
{
xDocumentHandler->startElement(TAG_SIGNEDINFO, uno::Reference<xml::sax::XAttributeList>(new SvXMLAttributeList()));
@@ -993,6 +993,30 @@ void XSecController::exportOOXMLSignature(const uno::Reference<xml::sax::XDocume
xDocumentHandler->endElement(TAG_SIGNATUREMETHOD);
}
+ const SignatureReferenceInformations& rReferences = rInformation.vSignatureReferenceInfors;
+ for (const SignatureReferenceInformation& rReference : rReferences)
+ {
+ if (rReference.nType == SignatureReferenceType::SAMEDOCUMENT)
+ {
+ {
+ std::unique_ptr<SvXMLAttributeList> pAttributeList(new SvXMLAttributeList());
+ pAttributeList->AddAttribute("Type", "http://www.w3.org/2000/09/xmldsig#Object");
+ pAttributeList->AddAttribute(ATTR_URI, rReference.ouURI);
+ xDocumentHandler->startElement(TAG_REFERENCE, uno::Reference<xml::sax::XAttributeList>(pAttributeList.release()));
+ }
+ {
+ std::unique_ptr<SvXMLAttributeList> pAttributeList(new SvXMLAttributeList());
+ pAttributeList->AddAttribute(ATTR_ALGORITHM, ALGO_XMLDSIGSHA256);
+ xDocumentHandler->startElement(TAG_DIGESTMETHOD, uno::Reference<xml::sax::XAttributeList>(pAttributeList.release()));
+ xDocumentHandler->endElement(TAG_DIGESTMETHOD);
+ }
+ xDocumentHandler->startElement(TAG_DIGESTVALUE, uno::Reference<xml::sax::XAttributeList>(new SvXMLAttributeList()));
+ xDocumentHandler->endElement(TAG_DIGESTVALUE);
+ xDocumentHandler->characters(rReference.ouDigestValue);
+ xDocumentHandler->endElement(TAG_REFERENCE);
+ }
+ }
+
xDocumentHandler->endElement(TAG_SIGNEDINFO);
}
diff --git a/xmlsecurity/source/helper/xsecctl.hxx b/xmlsecurity/source/helper/xsecctl.hxx
index 589183d4d10c..a67dc34ea3e3 100644
--- a/xmlsecurity/source/helper/xsecctl.hxx
+++ b/xmlsecurity/source/helper/xsecctl.hxx
@@ -97,6 +97,7 @@
#define ALGO_RSASHA1 "http://www.w3.org/2000/09/xmldsig#rsa-sha1"
#define ALGO_RSASHA256 "http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"
#define ALGO_XMLDSIGSHA1 "http://www.w3.org/2000/09/xmldsig#sha1"
+#define ALGO_XMLDSIGSHA256 "http://www.w3.org/2001/04/xmlenc#sha256"
#define ALGO_RELATIONSHIP "http://schemas.openxmlformats.org/package/2006/RelationshipTransform"
#define CHAR_FRAGMENT "#"