summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/sfx2/objsh.hxx10
-rw-r--r--sfx2/source/doc/objmisc.cxx2
-rw-r--r--sfx2/source/doc/objserv.cxx4
-rw-r--r--xmlsecurity/qa/unit/signing/data/signatureline.odtbin0 -> 27142 bytes
-rw-r--r--xmlsecurity/qa/unit/signing/signing.cxx28
5 files changed, 31 insertions, 13 deletions
diff --git a/include/sfx2/objsh.hxx b/include/sfx2/objsh.hxx
index a7f65b619e60..ced0db56320d 100644
--- a/include/sfx2/objsh.hxx
+++ b/include/sfx2/objsh.hxx
@@ -362,6 +362,10 @@ public:
bool HasValidSignatures();
SignatureState GetDocumentSignatureState();
void SignDocumentContent(weld::Window* pDialogParent);
+ css::uno::Sequence<css::security::DocumentSignatureInformation> GetDocumentSignatureInformation(
+ bool bScriptingContent,
+ const css::uno::Reference<css::security::XDocumentDigitalSignatures>& xSigner
+ = css::uno::Reference<css::security::XDocumentDigitalSignatures>());
bool SignDocumentContentUsingCertificate(const css::uno::Reference<css::security::XCertificate>& xCertificate);
@@ -745,12 +749,6 @@ public:
// configuration items
SAL_DLLPRIVATE SignatureState ImplGetSignatureState( bool bScriptingContent = false );
- SAL_DLLPRIVATE css::uno::Sequence< css::security::DocumentSignatureInformation >
- ImplAnalyzeSignature(
- bool bScriptingContent,
- const css::uno::Reference< css::security::XDocumentDigitalSignatures >& xSigner
- = css::uno::Reference< css::security::XDocumentDigitalSignatures >() );
-
SAL_DLLPRIVATE bool QuerySaveSizeExceededModules_Impl( const css::uno::Reference< css::task::XInteractionHandler >& xHandler );
SAL_DLLPRIVATE bool QueryAllowExoticFormat_Impl( const css::uno::Reference< css::task::XInteractionHandler >& xHandler,
const OUString& rURL,
diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx
index 4bcfd9118e59..e245800f2fec 100644
--- a/sfx2/source/doc/objmisc.cxx
+++ b/sfx2/source/doc/objmisc.cxx
@@ -1758,7 +1758,7 @@ bool SfxObjectShell_Impl::hasTrustedScriptingSignature( bool bAllowUIToAddAuthor
|| nScriptingSignatureState == SignatureState::OK
|| nScriptingSignatureState == SignatureState::NOTVALIDATED )
{
- uno::Sequence< security::DocumentSignatureInformation > aInfo = rDocShell.ImplAnalyzeSignature( true, xSigner );
+ uno::Sequence< security::DocumentSignatureInformation > aInfo = rDocShell.GetDocumentSignatureInformation( true, xSigner );
if ( aInfo.getLength() )
{
diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx
index 487afb1825d6..6777e64d9cf5 100644
--- a/sfx2/source/doc/objserv.cxx
+++ b/sfx2/source/doc/objserv.cxx
@@ -1328,7 +1328,7 @@ static bool HasSignatureStream(const uno::Reference<embed::XStorage>& xStorage)
return xNameAccess->hasByName("_xmlsignatures");
}
-uno::Sequence< security::DocumentSignatureInformation > SfxObjectShell::ImplAnalyzeSignature( bool bScriptingContent, const uno::Reference< security::XDocumentDigitalSignatures >& xSigner )
+uno::Sequence< security::DocumentSignatureInformation > SfxObjectShell::GetDocumentSignatureInformation( bool bScriptingContent, const uno::Reference< security::XDocumentDigitalSignatures >& xSigner )
{
uno::Sequence< security::DocumentSignatureInformation > aResult;
uno::Reference< security::XDocumentDigitalSignatures > xLocSigner = xSigner;
@@ -1394,7 +1394,7 @@ SignatureState SfxObjectShell::ImplGetSignatureState( bool bScriptingContent )
{
*pState = SignatureState::NOSIGNATURES;
- uno::Sequence< security::DocumentSignatureInformation > aInfos = ImplAnalyzeSignature( bScriptingContent );
+ uno::Sequence< security::DocumentSignatureInformation > aInfos = GetDocumentSignatureInformation( bScriptingContent );
*pState = ImplCheckSignaturesInformation( aInfos );
}
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()
{