diff options
author | Michael Stahl <michael.stahl@allotropia.de> | 2021-02-18 19:22:31 +0100 |
---|---|---|
committer | Samuel Mehrbrodt <samuel.mehrbrodt@allotropia.de> | 2021-03-25 10:33:46 +0100 |
commit | 15bd9a85a3ab6f2c78bb2b2db2c767cae0f9578b (patch) | |
tree | e4f73f2e8c5ab6641cedd935b7d4aab4e62fc78c /xmlsecurity/source/helper/xsecverify.cxx | |
parent | 205135016edb54d65ace93d5b7a416f381169e88 (diff) |
xmlsecurity: XSecParser confused about multiple timestamps
LO writes timestamp both to dc:date and xades:SigningTime elements.
The parser tries to avoid reading multiple dc:date, preferring the first
one, but doesn't care about multiple xades:SigningTime, for undocumented
reasons.
Ideally something should check all read values for consistency.
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111160
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
(cherry picked from commit 4ab8d9c09a5873ca0aea56dafa1ab34758d52ef7)
xmlsecurity: remove XSecController::setPropertyId()
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111252
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
(cherry picked from commit d2a345e1163616fe3201ef1d6c758e2e819214e0)
Change-Id: Ic018ee89797a1c8a4f870ae102af48006de930ef
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111908
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
(cherry picked from commit abe77c4fcb9ea97d9fff07eaea6d8863bcba5b02)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113054
Tested-by: Michael Stahl <michael.stahl@allotropia.de>
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Diffstat (limited to 'xmlsecurity/source/helper/xsecverify.cxx')
-rw-r--r-- | xmlsecurity/source/helper/xsecverify.cxx | 39 |
1 files changed, 16 insertions, 23 deletions
diff --git a/xmlsecurity/source/helper/xsecverify.cxx b/xmlsecurity/source/helper/xsecverify.cxx index c826971b1c7d..cdca811cc2cb 100644 --- a/xmlsecurity/source/helper/xsecverify.cxx +++ b/xmlsecurity/source/helper/xsecverify.cxx @@ -317,7 +317,7 @@ void XSecController::setGpgOwner( OUString const & ouGpgOwner ) isi.signatureInfor.ouGpgOwner = ouGpgOwner; } -void XSecController::setDate( OUString const & ouDate ) +void XSecController::setDate(OUString const& rId, OUString const& ouDate) { if (m_vInternalSignatureInformations.empty()) { @@ -325,17 +325,31 @@ void XSecController::setDate( OUString const & ouDate ) return; } InternalSignatureInformation &isi = m_vInternalSignatureInformations.back(); + // there may be multiple timestamps in a signature - check them for consistency + if (!isi.signatureInfor.ouDateTime.isEmpty() + && isi.signatureInfor.ouDateTime != ouDate) + { + isi.signatureInfor.hasInconsistentSigningTime = true; + } (void)utl::ISO8601parseDateTime( ouDate, isi.signatureInfor.stDateTime); isi.signatureInfor.ouDateTime = ouDate; + if (!rId.isEmpty()) + { + isi.signatureInfor.ouDateTimePropertyId = rId; + } } -void XSecController::setDescription(const OUString& rDescription) +void XSecController::setDescription(OUString const& rId, OUString const& rDescription) { if (m_vInternalSignatureInformations.empty()) return; InternalSignatureInformation& rInformation = m_vInternalSignatureInformations.back(); rInformation.signatureInfor.ouDescription = rDescription; + if (!rId.isEmpty()) + { + rInformation.signatureInfor.ouDescriptionPropertyId = rId; + } } void XSecController::setSignatureBytes(const uno::Sequence<sal_Int8>& rBytes) @@ -429,27 +443,6 @@ void XSecController::setId( OUString const & ouId ) isi.signatureInfor.ouSignatureId = ouId; } -void XSecController::setPropertyId( OUString const & ouPropertyId ) -{ - if (m_vInternalSignatureInformations.empty()) - { - SAL_INFO("xmlsecurity.helper","XSecController::setPropertyId: no signature"); - return; - } - InternalSignatureInformation &isi = m_vInternalSignatureInformations.back(); - - if (isi.signatureInfor.ouPropertyId.isEmpty()) - { - // <SignatureProperty> ID attribute is for the date. - isi.signatureInfor.ouPropertyId = ouPropertyId; - } - else - { - // <SignatureProperty> ID attribute is for the description. - isi.signatureInfor.ouDescriptionPropertyId = ouPropertyId; - } -} - /* public: for signature verify */ void XSecController::collectToVerify( const OUString& referenceId ) { |