xmlsecurity/inc/xmlsecurity/xmlsignaturehelper.hxx | 2 ++ xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx | 10 ++++++++++ xmlsecurity/source/helper/xmlsignaturehelper.cxx | 9 +++++++++ 3 files changed, 21 insertions(+)
New commits: commit 976ec559d9f7e3ed42d445884a7037cf898bf636 Author: Miklos Vajna <[email protected]> Date: Fri Feb 5 14:39:28 2016 +0100 xmlsecurity: write origin.sigs when exporting OOXML signature It's an empty file, with the only purpose to have relations, referencing the individual signature streams. The only tricky part is that a temp file needs closeOutput() to flush its contents, flush() is not enough. Change-Id: I92ac61bce201c97a727ff02b1bb74599573a1807 diff --git a/xmlsecurity/inc/xmlsecurity/xmlsignaturehelper.hxx b/xmlsecurity/inc/xmlsecurity/xmlsignaturehelper.hxx index 543ec61..4cb3002 100644 --- a/xmlsecurity/inc/xmlsecurity/xmlsignaturehelper.hxx +++ b/xmlsecurity/inc/xmlsecurity/xmlsignaturehelper.hxx @@ -184,6 +184,8 @@ public: bool ReadAndVerifySignatureStorageStream(const css::uno::Reference<css::io::XInputStream>& xInputStream); /// Adds an OOXML digital signature relation to _rels/.rels if there wasn't any before. void EnsureSignaturesRelation(css::uno::Reference<css::embed::XStorage> xStorage); + /// Given that xStorage is an OOXML _xmlsignatures storage, create origin.sigs and its relations. + static void ExportSignatureRelations(css::uno::Reference<css::embed::XStorage> xStorage, int nSignatureCount); }; #endif // INCLUDED_XMLSECURITY_INC_XMLSECURITY_XMLSIGNATUREHELPER_HXX diff --git a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx index 6641c0d..6f39501 100644 --- a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx +++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx @@ -516,6 +516,16 @@ IMPL_LINK_NOARG_TYPED(DigitalSignaturesDialog, AddButtonHdl, Button*, void) { // OOXML maSignatureHelper.EnsureSignaturesRelation(mxStore); + + // Old signatures + the new one. + int nSignatureCount = maCurrentSignatureInformations.size() + 1; + XMLSignatureHelper::ExportSignatureRelations(aStreamHelper.xSignatureStorage, nSignatureCount); + + // Flush objects. + uno::Reference<embed::XTransactedObject> xTransact(aStreamHelper.xSignatureStorage, uno::UNO_QUERY); + xTransact->commit(); + uno::Reference<io::XOutputStream> xOutputStream(aStreamHelper.xSignatureStream, uno::UNO_QUERY); + xOutputStream->closeOutput(); } maSignatureHelper.EndMission(); diff --git a/xmlsecurity/source/helper/xmlsignaturehelper.cxx b/xmlsecurity/source/helper/xmlsignaturehelper.cxx index 4d2293c..cfd0c62 100644 --- a/xmlsecurity/source/helper/xmlsignaturehelper.cxx +++ b/xmlsecurity/source/helper/xmlsignaturehelper.cxx @@ -465,4 +465,13 @@ void XMLSignatureHelper::EnsureSignaturesRelation(css::uno::Reference<css::embed xTransact->commit(); } +void XMLSignatureHelper::ExportSignatureRelations(css::uno::Reference<css::embed::XStorage> xStorage, int /*nSignatureCount*/) +{ + sal_Int32 nOpenMode = embed::ElementModes::READWRITE; + uno::Reference<io::XOutputStream> xOriginStream(xStorage->openStreamElement("origin.sigs", nOpenMode), uno::UNO_QUERY); + uno::Reference<io::XTruncate> xTruncate(xOriginStream, uno::UNO_QUERY); + xTruncate->truncate(); + xOriginStream->closeOutput(); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
