summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2016-01-05 09:57:38 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-01-05 10:27:45 +0100
commita968893e6afd3b79c6c048962373859cea75a77b (patch)
treede0212ae04561475013c6523a6847d463d1a08b7
parentxmlsecurity: add XMLSignatureHelper::SetDescription() (diff)
downloadcore-a968893e6afd3b79c6c048962373859cea75a77b.tar.gz
core-a968893e6afd3b79c6c048962373859cea75a77b.zip
xmlsecurity: parse dc:description in XSecParser
With this, the description is written in the XML file, DigitalSignaturesDialog doesn't set it yet, though. Change-Id: I54a73d6fbdf8ed936714a21ba1df5998849fd1fa
-rw-r--r--xmlsecurity/source/helper/xsecctl.hxx1
-rw-r--r--xmlsecurity/source/helper/xsecparser.cxx16
-rw-r--r--xmlsecurity/source/helper/xsecparser.hxx3
-rw-r--r--xmlsecurity/source/helper/xsecverify.cxx9
4 files changed, 29 insertions, 0 deletions
diff --git a/xmlsecurity/source/helper/xsecctl.hxx b/xmlsecurity/source/helper/xsecctl.hxx
index 22b54e984bc3..dcb4eaa706a5 100644
--- a/xmlsecurity/source/helper/xsecctl.hxx
+++ b/xmlsecurity/source/helper/xsecctl.hxx
@@ -371,6 +371,7 @@ private:
void setDigestValue( OUString& ouDigestValue );
void setDate( OUString& ouDate );
+ void setDescription(const OUString& rDescription);
void setId( OUString& ouId );
void setPropertyId( OUString& ouPropertyId );
diff --git a/xmlsecurity/source/helper/xsecparser.cxx b/xmlsecurity/source/helper/xsecparser.cxx
index e429535b1ddd..b7d37343c4dc 100644
--- a/xmlsecurity/source/helper/xsecparser.cxx
+++ b/xmlsecurity/source/helper/xsecparser.cxx
@@ -35,6 +35,7 @@ XSecParser::XSecParser(XSecController* pXSecController,
, m_bInDigestValue(false)
, m_bInSignatureValue(false)
, m_bInDate(false)
+ , m_bInDescription(false)
, m_pXSecController(pXSecController)
, m_xNextHandler(xNextHandler)
, m_bReferenceUnresolved(false)
@@ -65,6 +66,7 @@ void SAL_CALL XSecParser::startDocument( )
m_bInSignatureValue = false;
m_bInDigestValue = false;
m_bInDate = false;
+ m_bInDescription = false;
if (m_xNextHandler.is())
{
@@ -176,6 +178,11 @@ void SAL_CALL XSecParser::startElement(
m_ouDate.clear();
m_bInDate = true;
}
+ else if (aName == NSTAG_DC ":" TAG_DESCRIPTION)
+ {
+ m_ouDescription.clear();
+ m_bInDescription = true;
+ }
if (m_xNextHandler.is())
{
@@ -248,6 +255,11 @@ void SAL_CALL XSecParser::endElement( const OUString& aName )
m_pXSecController->setDate( m_ouDate );
m_bInDate = false;
}
+ else if (aName == NSTAG_DC ":" TAG_DESCRIPTION)
+ {
+ m_pXSecController->setDescription( m_ouDescription );
+ m_bInDescription = false;
+ }
if (m_xNextHandler.is())
{
@@ -296,6 +308,10 @@ void SAL_CALL XSecParser::characters( const OUString& aChars )
{
m_ouDate += aChars;
}
+ else if (m_bInDescription)
+ {
+ m_ouDescription += aChars;
+ }
if (m_xNextHandler.is())
{
diff --git a/xmlsecurity/source/helper/xsecparser.hxx b/xmlsecurity/source/helper/xsecparser.hxx
index 0cf47b18424b..f87ca23685b9 100644
--- a/xmlsecurity/source/helper/xsecparser.hxx
+++ b/xmlsecurity/source/helper/xsecparser.hxx
@@ -64,6 +64,8 @@ private:
OUString m_ouDigestValue;
OUString m_ouSignatureValue;
OUString m_ouDate;
+ /// Characters of a <dc:description> element, as just read from XML.
+ OUString m_ouDescription;
/*
* whether inside a particular element
@@ -74,6 +76,7 @@ private:
bool m_bInDigestValue;
bool m_bInSignatureValue;
bool m_bInDate;
+ bool m_bInDescription;
/*
* the XSecController collaborating with XSecParser
diff --git a/xmlsecurity/source/helper/xsecverify.cxx b/xmlsecurity/source/helper/xsecverify.cxx
index 2ebd27d74d26..d41214e4be93 100644
--- a/xmlsecurity/source/helper/xsecverify.cxx
+++ b/xmlsecurity/source/helper/xsecverify.cxx
@@ -262,6 +262,15 @@ void XSecController::setDate( OUString& ouDate )
isi.signatureInfor.ouDateTime = ouDate;
}
+void XSecController::setDescription(const OUString& rDescription)
+{
+ if (m_vInternalSignatureInformations.empty())
+ return;
+
+ InternalSignatureInformation& rInformation = m_vInternalSignatureInformations.back();
+ rInformation.signatureInfor.ouDescription = rDescription;
+}
+
void XSecController::setId( OUString& ouId )
{
if (m_vInternalSignatureInformations.empty())