summaryrefslogtreecommitdiff
path: root/xmlsecurity
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2016-02-10 14:44:57 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-07-07 12:21:48 +0200
commit81588a6408b6e93d772512553834e42eda3ccfd7 (patch)
treea515a9845060afd45a3982fa03911b2fb0a9b31f /xmlsecurity
parentd9a117fdfd80a093a12e4ff84460a00259225093 (diff)
xmlsecurity OOXML export: write signature time
Change-Id: I88b0be8b375b7698224e08768d867b767c3a98ad (cherry picked from commit a2779756374d9e71e9ed6a1d7665f64cc5eacb0f)
Diffstat (limited to 'xmlsecurity')
-rw-r--r--xmlsecurity/source/helper/xsecctl.cxx40
-rw-r--r--xmlsecurity/source/helper/xsecctl.hxx3
2 files changed, 43 insertions, 0 deletions
diff --git a/xmlsecurity/source/helper/xsecctl.cxx b/xmlsecurity/source/helper/xsecctl.cxx
index 79581a103856..afe28cd7644e 100644
--- a/xmlsecurity/source/helper/xsecctl.cxx
+++ b/xmlsecurity/source/helper/xsecctl.cxx
@@ -1177,6 +1177,46 @@ void XSecController::exportOOXMLSignature(const uno::Reference<embed::XStorage>&
}
}
xDocumentHandler->endElement(TAG_MANIFEST);
+
+ // SignatureProperties
+ xDocumentHandler->startElement(TAG_SIGNATUREPROPERTIES, uno::Reference<xml::sax::XAttributeList>(new SvXMLAttributeList()));
+ {
+ rtl::Reference<SvXMLAttributeList> pAttributeList(new SvXMLAttributeList());
+ pAttributeList->AddAttribute(ATTR_ID, "idSignatureTime");
+ pAttributeList->AddAttribute(ATTR_TARGET, "#idPackageSignature");
+ xDocumentHandler->startElement(TAG_SIGNATUREPROPERTY, uno::Reference<xml::sax::XAttributeList>(pAttributeList.get()));
+ }
+ {
+ rtl::Reference<SvXMLAttributeList> pAttributeList(new SvXMLAttributeList());
+ pAttributeList->AddAttribute(ATTR_XMLNS ":" NSTAG_MDSSI, NS_MDSSI);
+ xDocumentHandler->startElement(NSTAG_MDSSI ":" TAG_SIGNATURETIME, uno::Reference<xml::sax::XAttributeList>(pAttributeList.get()));
+ }
+ xDocumentHandler->startElement(NSTAG_MDSSI ":" TAG_FORMAT, uno::Reference<xml::sax::XAttributeList>(new SvXMLAttributeList()));
+ xDocumentHandler->characters("YYYY-MM-DDThh:mm:ssTZD");
+ xDocumentHandler->endElement(NSTAG_MDSSI ":" TAG_FORMAT);
+
+ xDocumentHandler->startElement(NSTAG_MDSSI ":" TAG_VALUE, uno::Reference<xml::sax::XAttributeList>(new SvXMLAttributeList()));
+ OUString aSignatureTimeValue;
+ if (!rInformation.ouDateTime.isEmpty())
+ aSignatureTimeValue = rInformation.ouDateTime;
+ else
+ {
+ aSignatureTimeValue = utl::toISO8601(rInformation.stDateTime);
+ // Ignore sub-seconds.
+ sal_Int32 nCommaPos = aSignatureTimeValue.indexOf(',');
+ if (nCommaPos != -1)
+ {
+ aSignatureTimeValue = aSignatureTimeValue.copy(0, nCommaPos);
+ aSignatureTimeValue += "Z";
+ }
+ }
+ xDocumentHandler->characters(aSignatureTimeValue);
+ xDocumentHandler->endElement(NSTAG_MDSSI ":" TAG_VALUE);
+
+ xDocumentHandler->endElement(NSTAG_MDSSI ":" TAG_SIGNATURETIME);
+ xDocumentHandler->endElement(TAG_SIGNATUREPROPERTY);
+ xDocumentHandler->endElement(TAG_SIGNATUREPROPERTIES);
+
xDocumentHandler->endElement(TAG_OBJECT);
{
diff --git a/xmlsecurity/source/helper/xsecctl.hxx b/xmlsecurity/source/helper/xsecctl.hxx
index d2af2459fb5f..7146d886047e 100644
--- a/xmlsecurity/source/helper/xsecctl.hxx
+++ b/xmlsecurity/source/helper/xsecctl.hxx
@@ -85,6 +85,9 @@
#define TAG_QUALIFYINGPROPERTIES "QualifyingProperties"
#define TAG_SIGNEDPROPERTIES "SignedProperties"
#define TAG_RELATIONSHIPREFERENCE "RelationshipReference"
+#define TAG_SIGNATURETIME "SignatureTime"
+#define TAG_FORMAT "Format"
+#define TAG_VALUE "Value"
#define ATTR_XMLNS "xmlns"
#define ATTR_ALGORITHM "Algorithm"