[Libreoffice-commits] core.git: 3 commits - sfx2/source xmlsecurity/source
Miklos Vajna
vmiklos at collabora.co.uk
Tue Jan 19 08:33:10 PST 2016
sfx2/source/doc/docfile.cxx | 7 +++----
xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx | 3 +++
xmlsecurity/source/helper/ooxmlsecparser.cxx | 13 +++++++++++++
xmlsecurity/source/helper/ooxmlsecparser.hxx | 2 ++
4 files changed, 21 insertions(+), 4 deletions(-)
New commits:
commit 2737a187a6a7c2e04aa1c6b519a712cfb989c592
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Tue Jan 19 17:18:04 2016 +0100
xmlsecurity: import OOXML <mdssi:Value>
That stores the signature timestamp, and that now immediately shows up
in DigitalSignaturesDialog as well.
Change-Id: I83a63a10cf946f47a03e4570c461a92512638600
diff --git a/xmlsecurity/source/helper/ooxmlsecparser.cxx b/xmlsecurity/source/helper/ooxmlsecparser.cxx
index e47f9dd..d8b5c93 100644
--- a/xmlsecurity/source/helper/ooxmlsecparser.cxx
+++ b/xmlsecurity/source/helper/ooxmlsecparser.cxx
@@ -17,6 +17,7 @@ OOXMLSecParser::OOXMLSecParser(XSecController* pXSecController)
,m_bInDigestValue(false)
,m_bInSignatureValue(false)
,m_bInX509Certificate(false)
+ ,m_bInMdssiValue(false)
{
}
@@ -71,6 +72,11 @@ throw (xml::sax::SAXException, uno::RuntimeException, std::exception)
m_aX509Certificate.clear();
m_bInX509Certificate = true;
}
+ else if (rName == "mdssi:Value")
+ {
+ m_aMdssiValue.clear();
+ m_bInMdssiValue = true;
+ }
if (m_xNextHandler.is())
m_xNextHandler->startElement(rName, xAttribs);
@@ -94,6 +100,11 @@ void SAL_CALL OOXMLSecParser::endElement(const OUString& rName) throw (xml::sax:
m_pXSecController->setX509Certificate(m_aX509Certificate);
m_bInX509Certificate = false;
}
+ else if (rName == "mdssi:Value")
+ {
+ m_pXSecController->setDate(m_aMdssiValue);
+ m_bInMdssiValue = false;
+ }
if (m_xNextHandler.is())
m_xNextHandler->endElement(rName);
@@ -107,6 +118,8 @@ void SAL_CALL OOXMLSecParser::characters(const OUString& rChars) throw (xml::sax
m_aSignatureValue += rChars;
else if (m_bInX509Certificate)
m_aX509Certificate += rChars;
+ else if (m_bInMdssiValue)
+ m_aMdssiValue += rChars;
if (m_xNextHandler.is())
m_xNextHandler->characters(rChars);
diff --git a/xmlsecurity/source/helper/ooxmlsecparser.hxx b/xmlsecurity/source/helper/ooxmlsecparser.hxx
index 54c522b..b071bca 100644
--- a/xmlsecurity/source/helper/ooxmlsecparser.hxx
+++ b/xmlsecurity/source/helper/ooxmlsecparser.hxx
@@ -35,6 +35,8 @@ class OOXMLSecParser: public cppu::WeakImplHelper
OUString m_aSignatureValue;
bool m_bInX509Certificate;
OUString m_aX509Certificate;
+ bool m_bInMdssiValue;
+ OUString m_aMdssiValue;
public:
OOXMLSecParser(XSecController* pXSecController);
commit 8b8b5e21b03387d482ead79afe250cc7fe6e78f7
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Tue Jan 19 17:17:04 2016 +0100
xmlsecurity: handle OOXML signatures in ImplGetSignatureInformations()
With this, DigitalSignaturesDialog correctly shows the "Signed by" field
when reading a single valid OOXML signature.
Change-Id: Ic52a56767f65ab30924b07073d31677cb3a27de5
diff --git a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
index bb93298..ea2430b 100644
--- a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
+++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
@@ -24,6 +24,7 @@
#include <sax/tools/converter.hxx>
#include <com/sun/star/embed/XStorage.hpp>
+#include <com/sun/star/embed/StorageFormats.hpp>
#include <com/sun/star/embed/ElementModes.hpp>
#include <com/sun/star/io/XSeekable.hpp>
#include <com/sun/star/io/XTruncate.hpp>
@@ -744,6 +745,8 @@ void DigitalSignaturesDialog::ImplGetSignatureInformations(bool bUseTempStream)
uno::Reference< io::XInputStream > xInputStream( aStreamHelper.xSignatureStream, uno::UNO_QUERY );
maSignatureHelper.ReadAndVerifySignature( xInputStream );
}
+ else if (aStreamHelper.nStorageFormat == embed::StorageFormats::OFOPXML && aStreamHelper.xSignatureStorage.is())
+ maSignatureHelper.ReadAndVerifySignatureStorage(aStreamHelper.xSignatureStorage);
maSignatureHelper.EndMission();
maCurrentSignatureInformations = maSignatureHelper.GetSignatureInformations();
commit ac699587dc30f005f5e4657e95b0dbf6a9deebc3
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Tue Jan 19 17:16:00 2016 +0100
SfxMedium: only own format has the signature in a single stream
OOXML has one stream for each signature, so it wants a storage instead.
Change-Id: Iff2ed4b65d8c2023d02578ec4e80c13e36f55390
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index d30d52f..bb44a1c 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -3579,10 +3579,9 @@ bool SfxMedium::SignContents_Impl( bool bScriptingContent, const OUString& aODFV
}
else
{
- uno::Reference< io::XStream > xStream(
- xMetaInf->openStreamElement( xSigner->getDocumentContentSignatureDefaultStreamName(),
- embed::ElementModes::READWRITE ),
- uno::UNO_SET_THROW );
+ uno::Reference< io::XStream > xStream;
+ if (GetFilter() && GetFilter()->IsOwnFormat())
+ xStream.set(xMetaInf->openStreamElement(xSigner->getDocumentContentSignatureDefaultStreamName(), embed::ElementModes::READWRITE), uno::UNO_SET_THROW);
if ( xSigner->signDocumentContent( GetZipStorageToSign_Impl(), xStream ) )
{
More information about the Libreoffice-commits
mailing list