[Libreoffice-commits] core.git: 3 commits - xmlsecurity/source
Miklos Vajna
vmiklos at collabora.co.uk
Mon Feb 8 14:35:04 UTC 2016
xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx | 3 +
xmlsecurity/source/helper/xsecctl.cxx | 41 ++++++++++++++++-
xmlsecurity/source/helper/xsecctl.hxx | 2
3 files changed, 45 insertions(+), 1 deletion(-)
New commits:
commit 570d5af407d55c39621575e56c77817dbd429783
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Mon Feb 8 15:00:21 2016 +0100
xmlsecurity: initial OOXML support for writing same-document references
They are kind of a special case for ODF, but OOXML uses these
exclusively, and then one of them refers to the actual package streams.
Change-Id: I4663eef4bd718a7563effd6cafa790126db6d8c7
diff --git a/xmlsecurity/source/helper/xsecctl.cxx b/xmlsecurity/source/helper/xsecctl.cxx
index 81b8d97..cd1f7e3 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 589183d..a67dc34 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 "#"
commit 5138223ebf7e4bfa6bd13be1b195ff1a7f03c017
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Mon Feb 8 14:13:23 2016 +0100
xmlsecurity: log temporary OOXML storage location during export
This can be inspected after the add button handler finishes, but the
dialog is still alive.
Change-Id: I18ece31545de6d306a26b44d372f54df8221a456
diff --git a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
index 58fb01f..30a805e 100644
--- a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
+++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
@@ -530,6 +530,9 @@ IMPL_LINK_NOARG_TYPED(DigitalSignaturesDialog, AddButtonHdl, Button*, void)
xTransact->commit();
uno::Reference<io::XOutputStream> xOutputStream(aStreamHelper.xSignatureStream, uno::UNO_QUERY);
xOutputStream->closeOutput();
+
+ uno::Reference<io::XTempFile> xTempFile(aStreamHelper.xSignatureStream, uno::UNO_QUERY);
+ SAL_INFO("xmlsecurity.dialogs", "AddButtonHdl: temporary storage is at " << xTempFile->getUri());
}
maSignatureHelper.EndMission();
commit 7ff681fddaeff5cea22a1978bd4916e0c6bc28f9
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Mon Feb 8 14:09:45 2016 +0100
xmlsecurity: export OOXML <SignatureMethod>
Change-Id: I445a50d5c7d12609e4043bfedc41cdea456fa52f
diff --git a/xmlsecurity/source/helper/xsecctl.cxx b/xmlsecurity/source/helper/xsecctl.cxx
index fcbd828..81b8d97 100644
--- a/xmlsecurity/source/helper/xsecctl.cxx
+++ b/xmlsecurity/source/helper/xsecctl.cxx
@@ -978,6 +978,21 @@ void XSecController::exportSignature(
void XSecController::exportOOXMLSignature(const uno::Reference<xml::sax::XDocumentHandler>& xDocumentHandler, const SignatureInformation& /*rInformation*/)
{
xDocumentHandler->startElement(TAG_SIGNEDINFO, uno::Reference<xml::sax::XAttributeList>(new SvXMLAttributeList()));
+
+ {
+ std::unique_ptr<SvXMLAttributeList> pAttributeList(new SvXMLAttributeList());
+ pAttributeList->AddAttribute(ATTR_ALGORITHM, ALGO_C14N);
+ xDocumentHandler->startElement(TAG_CANONICALIZATIONMETHOD, uno::Reference<xml::sax::XAttributeList>(pAttributeList.release()));
+ xDocumentHandler->endElement(TAG_CANONICALIZATIONMETHOD);
+ }
+
+ {
+ std::unique_ptr<SvXMLAttributeList> pAttributeList(new SvXMLAttributeList());
+ pAttributeList->AddAttribute(ATTR_ALGORITHM, ALGO_RSASHA256);
+ xDocumentHandler->startElement(TAG_SIGNATUREMETHOD, uno::Reference<xml::sax::XAttributeList>(pAttributeList.release()));
+ xDocumentHandler->endElement(TAG_SIGNATUREMETHOD);
+ }
+
xDocumentHandler->endElement(TAG_SIGNEDINFO);
}
diff --git a/xmlsecurity/source/helper/xsecctl.hxx b/xmlsecurity/source/helper/xsecctl.hxx
index 967e603..589183d 100644
--- a/xmlsecurity/source/helper/xsecctl.hxx
+++ b/xmlsecurity/source/helper/xsecctl.hxx
@@ -95,6 +95,7 @@
#define ALGO_C14N "http://www.w3.org/TR/2001/REC-xml-c14n-20010315"
#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_RELATIONSHIP "http://schemas.openxmlformats.org/package/2006/RelationshipTransform"
More information about the Libreoffice-commits
mailing list