diff options
author | Michael Stahl <michael.stahl@allotropia.de> | 2021-02-26 17:24:10 +0100 |
---|---|---|
committer | Michael Stahl <michael.stahl@allotropia.de> | 2022-04-01 14:02:02 +0200 |
commit | c3b60708292f3af96c63c24d18d686dca06788f4 (patch) | |
tree | fdb72594141ab4d8b20fac598209a7de2e918808 | |
parent | libxml2: upgrade to release 2.9.13 (diff) | |
download | core-c3b60708292f3af96c63c24d18d686dca06788f4.tar.gz core-c3b60708292f3af96c63c24d18d686dca06788f4.zip |
xmlsecurity: add test for timestamps
Change-Id: I6ce64ca7c59639684779144ed0ed8d36c4aca32b
(cherry picked from commit cec50077eaef32890d9565237277a607c7721c83)
-rw-r--r-- | xmlsecurity/qa/unit/signing/data/02_doc_signed_by_trusted_person_manipulated.odt | bin | 0 -> 14003 bytes | |||
-rw-r--r-- | xmlsecurity/qa/unit/signing/signing.cxx | 22 |
2 files changed, 22 insertions, 0 deletions
diff --git a/xmlsecurity/qa/unit/signing/data/02_doc_signed_by_trusted_person_manipulated.odt b/xmlsecurity/qa/unit/signing/data/02_doc_signed_by_trusted_person_manipulated.odt Binary files differnew file mode 100644 index 000000000000..4136b32e5610 --- /dev/null +++ b/xmlsecurity/qa/unit/signing/data/02_doc_signed_by_trusted_person_manipulated.odt diff --git a/xmlsecurity/qa/unit/signing/signing.cxx b/xmlsecurity/qa/unit/signing/signing.cxx index f9d3e148c05b..16baf11289e2 100644 --- a/xmlsecurity/qa/unit/signing/signing.cxx +++ b/xmlsecurity/qa/unit/signing/signing.cxx @@ -559,6 +559,28 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testODFNo) static_cast<int>(pObjectShell->GetDocumentSignatureState())); } +// document has one signed timestamp and one unsigned timestamp +CPPUNIT_TEST_FIXTURE(SigningTest, testODFUnsignedTimestamp) +{ + createDoc(m_directories.getURLFromSrc(DATA_DIRECTORY) + + "02_doc_signed_by_trusted_person_manipulated.odt"); + SfxBaseModel* pBaseModel = dynamic_cast<SfxBaseModel*>(mxComponent.get()); + CPPUNIT_ASSERT(pBaseModel); + SfxObjectShell* pObjectShell = pBaseModel->GetObjectShell(); + CPPUNIT_ASSERT(pObjectShell); + SignatureState nActual = pObjectShell->GetDocumentSignatureState(); + CPPUNIT_ASSERT_MESSAGE( + (OString::number(o3tl::underlyingEnumValue(nActual)).getStr()), + (nActual == SignatureState::NOTVALIDATED || nActual == SignatureState::OK)); + uno::Sequence<security::DocumentSignatureInformation> const infos( + pObjectShell->GetDocumentSignatureInformation(false)); + CPPUNIT_ASSERT_EQUAL(sal_Int32(1), infos.getLength()); + // was: 66666666 + CPPUNIT_ASSERT_EQUAL(sal_Int32(20210126), infos[0].SignatureDate); + // was: 0 + CPPUNIT_ASSERT_EQUAL(sal_Int32(18183742), infos[0].SignatureTime); +} + /// Test a typical OOXML where a number of (but not all) streams are signed. CPPUNIT_TEST_FIXTURE(SigningTest, testOOXMLPartial) { |