[Libreoffice-commits] core.git: xmlsecurity/source
Tor Lillqvist
tml at collabora.com
Fri Nov 18 13:59:18 UTC 2016
xmlsecurity/source/helper/xsecparser.cxx | 26 ++++++++++++++++++++++----
xmlsecurity/source/helper/xsecparser.hxx | 1 +
2 files changed, 23 insertions(+), 4 deletions(-)
New commits:
commit 60f75c333b3040464ca9d251e579c865916d827e
Author: Tor Lillqvist <tml at collabora.com>
Date: Fri Nov 18 14:21:07 2016 +0200
Prefer to take the signature date from the XAdES SigningTime, if present
Change-Id: I15a00a8c6f8c8e735694baa25e06ed4db0875d43
diff --git a/xmlsecurity/source/helper/xsecparser.cxx b/xmlsecurity/source/helper/xsecparser.cxx
index 64cf226..d4c9f9d 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 c7a326b..c9463cc 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;
More information about the Libreoffice-commits
mailing list