diff options
author | Tor Lillqvist <tml@collabora.com> | 2016-11-18 14:21:07 +0200 |
---|---|---|
committer | Tor Lillqvist <tml@collabora.com> | 2016-11-18 15:58:12 +0200 |
commit | 60f75c333b3040464ca9d251e579c865916d827e (patch) | |
tree | 0f81206c73db67deb1454953bd2fda8890dffc35 /xmlsecurity | |
parent | 0bc023d55afcf373a3b6644545ce4bae1bb5ca47 (diff) |
Prefer to take the signature date from the XAdES SigningTime, if present
Change-Id: I15a00a8c6f8c8e735694baa25e06ed4db0875d43
Diffstat (limited to 'xmlsecurity')
-rw-r--r-- | xmlsecurity/source/helper/xsecparser.cxx | 26 | ||||
-rw-r--r-- | xmlsecurity/source/helper/xsecparser.hxx | 1 |
2 files changed, 23 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()) { diff --git a/xmlsecurity/source/helper/xsecparser.hxx b/xmlsecurity/source/helper/xsecparser.hxx index c7a326b44714..c9463cc485dc 100644 --- a/xmlsecurity/source/helper/xsecparser.hxx +++ b/xmlsecurity/source/helper/xsecparser.hxx @@ -73,6 +73,7 @@ private: bool m_bInX509Certificate; bool m_bInCertDigest; bool m_bInEncapsulatedX509Certificate; + bool m_bInSigningTime; bool m_bInDigestValue; bool m_bInSignatureValue; bool m_bInDate; |