summaryrefslogtreecommitdiff
path: root/xmlsecurity/source/helper/ooxmlsecparser.cxx
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2016-02-12 09:49:37 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-02-12 10:11:05 +0100
commit89af47f2b3fba6692a1cea850159b2163a64db8b (patch)
tree9f4aad6c06a55f1c2db545ba06f2188a7081bd31 /xmlsecurity/source/helper/ooxmlsecparser.cxx
parent0acbf9404a40e5ca87642af299218846d51cf009 (diff)
xmlsecurity: import OOXML <xd:CertDigest>
Another redundant field: it's the SHA-256 digest of the certificate data for OOXML, not used for ODF. We need to store it after import, as we no longer have the security environment at hand when we store the signature to the persistent storage. Change-Id: I3bcccb3c7c4f4178c0b267ce87777fba543f8716
Diffstat (limited to 'xmlsecurity/source/helper/ooxmlsecparser.cxx')
-rw-r--r--xmlsecurity/source/helper/ooxmlsecparser.cxx19
1 files changed, 16 insertions, 3 deletions
diff --git a/xmlsecurity/source/helper/ooxmlsecparser.cxx b/xmlsecurity/source/helper/ooxmlsecparser.cxx
index 2086d3876283..cc764b69b0be 100644
--- a/xmlsecurity/source/helper/ooxmlsecparser.cxx
+++ b/xmlsecurity/source/helper/ooxmlsecparser.cxx
@@ -21,6 +21,7 @@ OOXMLSecParser::OOXMLSecParser(XSecController* pXSecController)
,m_bInSignatureComments(false)
,m_bInX509IssuerName(false)
,m_bInX509SerialNumber(false)
+ ,m_bInCertDigest(false)
,m_bReferenceUnresolved(false)
{
}
@@ -77,7 +78,7 @@ throw (xml::sax::SAXException, uno::RuntimeException, std::exception)
}
}
}
- else if (rName == "DigestValue")
+ else if (rName == "DigestValue" && !m_bInCertDigest)
{
m_aDigestValue.clear();
m_bInDigestValue = true;
@@ -112,6 +113,11 @@ throw (xml::sax::SAXException, uno::RuntimeException, std::exception)
m_aX509SerialNumber.clear();
m_bInX509SerialNumber = true;
}
+ else if (rName == "xd:CertDigest")
+ {
+ m_aCertDigest.clear();
+ m_bInCertDigest = true;
+ }
if (m_xNextHandler.is())
m_xNextHandler->startElement(rName, xAttribs);
@@ -131,7 +137,7 @@ void SAL_CALL OOXMLSecParser::endElement(const OUString& rName) throw (xml::sax:
}
m_pXSecController->setDigestValue(m_aDigestValue);
}
- else if (rName == "DigestValue")
+ else if (rName == "DigestValue" && !m_bInCertDigest)
m_bInDigestValue = false;
else if (rName == "SignatureValue")
{
@@ -163,6 +169,11 @@ void SAL_CALL OOXMLSecParser::endElement(const OUString& rName) throw (xml::sax:
m_pXSecController->setX509SerialNumber(m_aX509SerialNumber);
m_bInX509SerialNumber = false;
}
+ else if (rName == "xd:CertDigest")
+ {
+ m_pXSecController->setCertDigest(m_aCertDigest);
+ m_bInCertDigest = false;
+ }
if (m_xNextHandler.is())
m_xNextHandler->endElement(rName);
@@ -170,7 +181,7 @@ void SAL_CALL OOXMLSecParser::endElement(const OUString& rName) throw (xml::sax:
void SAL_CALL OOXMLSecParser::characters(const OUString& rChars) throw (xml::sax::SAXException, uno::RuntimeException, std::exception)
{
- if (m_bInDigestValue)
+ if (m_bInDigestValue && !m_bInCertDigest)
m_aDigestValue += rChars;
else if (m_bInSignatureValue)
m_aSignatureValue += rChars;
@@ -184,6 +195,8 @@ void SAL_CALL OOXMLSecParser::characters(const OUString& rChars) throw (xml::sax
m_aX509IssuerName += rChars;
else if (m_bInX509SerialNumber)
m_aX509SerialNumber += rChars;
+ else if (m_bInCertDigest)
+ m_aCertDigest += rChars;
if (m_xNextHandler.is())
m_xNextHandler->characters(rChars);