summaryrefslogtreecommitdiff
path: root/xmlsecurity/qa
diff options
context:
space:
mode:
authorSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2018-11-13 16:02:13 +0100
committerSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2018-11-14 08:19:45 +0100
commitd7f638f38fee26458e5e233c647248307f4e0f70 (patch)
treed0790222dd67e49a999575e0858fb98f94290a8e /xmlsecurity/qa
parentad4a5d17ec9522c581f8ecd61ff494793ab14ff8 (diff)
Add unit test for reading ODF signed signatureline
Change-Id: I4423a32fe84c6f13457e92aa0de913ee22995119 Reviewed-on: https://gerrit.libreoffice.org/63333 Tested-by: Jenkins Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'xmlsecurity/qa')
-rw-r--r--xmlsecurity/qa/unit/signing/data/signatureline.odtbin0 -> 27142 bytes
-rw-r--r--xmlsecurity/qa/unit/signing/signing.cxx28
2 files changed, 24 insertions, 4 deletions
diff --git a/xmlsecurity/qa/unit/signing/data/signatureline.odt b/xmlsecurity/qa/unit/signing/data/signatureline.odt
new file mode 100644
index 000000000000..d3a3e4671e5f
--- /dev/null
+++ b/xmlsecurity/qa/unit/signing/data/signatureline.odt
Binary files differ
diff --git a/xmlsecurity/qa/unit/signing/signing.cxx b/xmlsecurity/qa/unit/signing/signing.cxx
index ef5bbbda05ff..15553c922934 100644
--- a/xmlsecurity/qa/unit/signing/signing.cxx
+++ b/xmlsecurity/qa/unit/signing/signing.cxx
@@ -105,8 +105,9 @@ public:
void testXAdES();
/// Works with an existing good XAdES signature.
void testXAdESGood();
- /// Test importing of signature line images
- void testSignatureLineImages();
+ /// Test importing of signature line
+ void testSignatureLineOOXML();
+ void testSignatureLineODF();
#if HAVE_FEATURE_GPGVERIFY
/// Test a typical ODF where all streams are GPG-signed.
void testODFGoodGPG();
@@ -145,7 +146,8 @@ public:
CPPUNIT_TEST(test96097Doc);
CPPUNIT_TEST(testXAdES);
CPPUNIT_TEST(testXAdESGood);
- CPPUNIT_TEST(testSignatureLineImages);
+ CPPUNIT_TEST(testSignatureLineOOXML);
+ CPPUNIT_TEST(testSignatureLineODF);
#if HAVE_FEATURE_GPGVERIFY
CPPUNIT_TEST(testODFGoodGPG);
CPPUNIT_TEST(testODFUntrustedGoodGPG);
@@ -850,7 +852,7 @@ void SigningTest::testXAdESGood()
(nActual == SignatureState::NOTVALIDATED || nActual == SignatureState::OK));
}
-void SigningTest::testSignatureLineImages()
+void SigningTest::testSignatureLineOOXML()
{
// Given: A document (docx) with a signature line and a valid signature
uno::Reference<security::XDocumentDigitalSignatures> xSignatures(
@@ -876,6 +878,24 @@ void SigningTest::testSignatureLineImages()
CPPUNIT_ASSERT(xSignatureInfo[0].InvalidSignatureLineImage.is());
}
+void SigningTest::testSignatureLineODF()
+{
+ createDoc(m_directories.getURLFromSrc(DATA_DIRECTORY) + "signatureline.odt");
+ SfxBaseModel* pBaseModel = dynamic_cast<SfxBaseModel*>(mxComponent.get());
+ CPPUNIT_ASSERT(pBaseModel);
+ SfxObjectShell* pObjectShell = pBaseModel->GetObjectShell();
+ CPPUNIT_ASSERT(pObjectShell);
+
+ uno::Sequence<security::DocumentSignatureInformation> xSignatureInfo
+ = pObjectShell->GetDocumentSignatureInformation(false);
+
+ CPPUNIT_ASSERT(xSignatureInfo[0].SignatureIsValid);
+ CPPUNIT_ASSERT_EQUAL(OUString("{41CF56EE-331B-4125-97D8-2F5669DD3AAC}"),
+ xSignatureInfo[0].SignatureLineId);
+ CPPUNIT_ASSERT(xSignatureInfo[0].ValidSignatureLineImage.is());
+ CPPUNIT_ASSERT(xSignatureInfo[0].InvalidSignatureLineImage.is());
+}
+
#if HAVE_FEATURE_GPGVERIFY
void SigningTest::testODFGoodGPG()
{