summaryrefslogtreecommitdiffstats
path: root/xmlsecurity/source/helper/xsecparser.cxx
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2016-11-18 14:21:07 +0200
committerTor Lillqvist <tml@collabora.com>2016-11-18 15:58:12 +0200
commit60f75c333b3040464ca9d251e579c865916d827e (patch)
tree0f81206c73db67deb1454953bd2fda8890dffc35 /xmlsecurity/source/helper/xsecparser.cxx
parentfdo#71409: Prevent the a11y code from creating an edit view instance. (diff)
downloadcore-60f75c333b3040464ca9d251e579c865916d827e.tar.gz
core-60f75c333b3040464ca9d251e579c865916d827e.zip
Prefer to take the signature date from the XAdES SigningTime, if present
Change-Id: I15a00a8c6f8c8e735694baa25e06ed4db0875d43
Diffstat (limited to 'xmlsecurity/source/helper/xsecparser.cxx')
-rw-r--r--xmlsecurity/source/helper/xsecparser.cxx26
1 files changed, 22 insertions, 4 deletions
diff --git a/xmlsecurity/source/helper/xsecparser.cxx b/xmlsecurity/source/helper/xsecparser.cxx
index 64cf22621f72..d4c9f9dcfe0d 100644
--- a/xmlsecurity/source/helper/xsecparser.cxx
+++ b/xmlsecurity/source/helper/xsecparser.cxx
@@ -34,6 +34,7 @@ XSecParser::XSecParser(XSecController* pXSecController,
, m_bInX509Certificate(false)
, m_bInCertDigest(false)
, m_bInEncapsulatedX509Certificate(false)
+ , m_bInSigningTime(false)
, m_bInDigestValue(false)
, m_bInSignatureValue(false)
, m_bInDate(false)
@@ -198,6 +199,11 @@ void SAL_CALL XSecParser::startElement(
m_ouEncapsulatedX509Certificate.clear();
m_bInEncapsulatedX509Certificate = true;
}
+ else if (aName == "xd:SigningTime" || aName == "xades:SigningTime")
+ {
+ m_ouDate.clear();
+ m_bInSigningTime = true;
+ }
else if ( aName == "SignatureProperty" )
{
if (!ouIdAttr.isEmpty())
@@ -207,8 +213,8 @@ void SAL_CALL XSecParser::startElement(
}
else if (aName == "dc:date")
{
- m_ouDate.clear();
- m_bInDate = true;
+ if (m_ouDate.isEmpty())
+ m_bInDate = true;
}
else if (aName == "dc:description")
{
@@ -292,10 +298,18 @@ void SAL_CALL XSecParser::endElement( const OUString& aName )
m_pXSecController->addEncapsulatedX509Certificate( m_ouEncapsulatedX509Certificate );
m_bInEncapsulatedX509Certificate = false;
}
- else if (aName == "dc:date")
+ else if (aName == "xd:SigningTime" || aName == "xades:SigningTime")
{
m_pXSecController->setDate( m_ouDate );
- m_bInDate = false;
+ m_bInSigningTime = false;
+ }
+ else if (aName == "dc:date")
+ {
+ if (m_bInDate)
+ {
+ m_pXSecController->setDate( m_ouDate );
+ m_bInDate = false;
+ }
}
else if (aName == "dc:description")
{
@@ -362,6 +376,10 @@ void SAL_CALL XSecParser::characters( const OUString& aChars )
{
m_ouEncapsulatedX509Certificate += aChars;
}
+ else if (m_bInSigningTime)
+ {
+ m_ouDate += aChars;
+ }
if (m_xNextHandler.is())
{