diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-01-25 15:34:38 +0100 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2016-01-25 18:26:16 +0100 |
commit | 0dac6d1f179c286dd7aea2d9ef7c37db8323fa37 (patch) | |
tree | 06d7e6fcc0de4747f93da7153b45aa624b4f5bb1 /xmlsecurity/source/helper/ooxmlsecparser.cxx | |
parent | Revert "fdo#62947 make IDs unique, fixes, better names" (diff) | |
download | core-0dac6d1f179c286dd7aea2d9ef7c37db8323fa37.tar.gz core-0dac6d1f179c286dd7aea2d9ef7c37db8323fa37.zip |
xmlsecurity: implement OOXML stream references
With this, if see an URI like:
/_rels/.rels?ContentType=application/vnd.openxmlformats-package.relationships+xml
Then it is properly detected that it's the .rels stream of the _rels
storage, and UriBindingHelper will serve that stream (when looked up by
name later) to libxmlsec.
Change-Id: Iac62cb170c0aa8bb92c40311fb7b248e96c25dde
Diffstat (limited to 'xmlsecurity/source/helper/ooxmlsecparser.cxx')
-rw-r--r-- | xmlsecurity/source/helper/ooxmlsecparser.cxx | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/xmlsecurity/source/helper/ooxmlsecparser.cxx b/xmlsecurity/source/helper/ooxmlsecparser.cxx index 4bc7274b783b..4c930d18ea21 100644 --- a/xmlsecurity/source/helper/ooxmlsecparser.cxx +++ b/xmlsecurity/source/helper/ooxmlsecparser.cxx @@ -19,6 +19,7 @@ OOXMLSecParser::OOXMLSecParser(XSecController* pXSecController) ,m_bInX509Certificate(false) ,m_bInMdssiValue(false) ,m_bInSignatureComments(false) + ,m_bReferenceUnresolved(false) { } @@ -56,7 +57,23 @@ throw (xml::sax::SAXException, uno::RuntimeException, std::exception) OUString aURI = xAttribs->getValueByName("URI"); if (aURI.startsWith("#")) m_pXSecController->addReference(aURI.copy(1)); - // TODO else + else + { + m_aReferenceURI = aURI; + m_bReferenceUnresolved = true; + } + } + else if (rName == "Transform") + { + if (m_bReferenceUnresolved) + { + OUString aAlgorithm = xAttribs->getValueByName("Algorithm"); + if (aAlgorithm == ALGO_RELATIONSHIP) + { + m_pXSecController->addStreamReference(m_aReferenceURI, /*isBinary=*/false); + m_bReferenceUnresolved = false; + } + } } else if (rName == "DigestValue") { @@ -93,7 +110,15 @@ void SAL_CALL OOXMLSecParser::endElement(const OUString& rName) throw (xml::sax: if (rName == "SignedInfo") m_pXSecController->setReferenceCount(); else if (rName == "Reference") + { + if (m_bReferenceUnresolved) + { + // No transform algorithm found, assume binary. + m_pXSecController->addStreamReference(m_aReferenceURI, /*isBinary=*/true); + m_bReferenceUnresolved = false; + } m_pXSecController->setDigestValue(m_aDigestValue); + } else if (rName == "DigestValue") m_bInDigestValue = false; else if (rName == "SignatureValue") |