cui/source/dialogs/SignSignatureLineDialog.cxx         |    8 +++-
 desktop/source/lib/init.cxx                            |    4 +-
 include/sfx2/viewsh.hxx                                |    5 +--
 include/svl/cryptosign.hxx                             |   13 +++++++
 include/svx/signaturelinehelper.hxx                    |    9 ++---
 sd/qa/unit/tiledrendering/data/empty.pdf               |binary
 sd/qa/unit/tiledrendering/tiledrendering.cxx           |   28 +++++++++++++++++
 sd/source/ui/func/fuconrec.cxx                         |   17 ++++++----
 sd/source/ui/view/drviewse.cxx                         |   17 ++++++++--
 sfx2/source/doc/objserv.cxx                            |    6 +--
 sfx2/source/view/viewimp.hxx                           |    3 +
 sfx2/source/view/viewsh.cxx                            |    8 ++--
 svx/qa/unit/svdraw.cxx                                 |    4 +-
 svx/sdi/svx.sdi                                        |    2 -
 svx/source/dialog/signaturelinehelper.cxx              |   25 +++++++++++----
 vcl/qa/cppunit/filter/ipdf/ipdf.cxx                    |    4 +-
 xmlsecurity/qa/unit/signing/signing.cxx                |    4 +-
 xmlsecurity/source/dialogs/certificatechooser.cxx      |    5 +--
 xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx |    2 -
 19 files changed, 123 insertions(+), 41 deletions(-)

New commits:
commit de5c5df212de382ceb7273fcab1ee503a0a19d59
Author:     Miklos Vajna <vmik...@collabora.com>
AuthorDate: Mon Jan 13 11:18:12 2025 +0100
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Mon Jan 13 12:57:02 2025 +0100

    cool#10630 doc electronic sign: fix insertion of the signature line
    
    Have electronic signing configured in the LOK client, try to insert a
    signature line, you'll get a certificate picker, while we don't have a
    cert during esign.
    
    What's in fact needed for creating the signature line is just a name
    (previously extracted from the certificate), we can survive the lack of
    actual certificate.
    
    Fix the problem by adding a new External parameter to
    .uno:InsertSignatureLine to hint that the certificate chooser should not
    be opened, instead the editor name (used for comments already) should be
    used. Add a new CertificateOrName in svl/ and use that in all places
    where previously we wanted a certificate but in fact it's enough to have
    a certificate or a name to create the signature line.
    
    The name on the signature line is just visual feedback, the actual name
    on the crypto signature is still not based on untrusted used input.
    
    Change-Id: Ib7008112a8e28a9e7d9649745e6021dd6b6b9c39
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180167
    Tested-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>

diff --git a/cui/source/dialogs/SignSignatureLineDialog.cxx 
b/cui/source/dialogs/SignSignatureLineDialog.cxx
index 43699ac3dc83..00bda303d4ea 100644
--- a/cui/source/dialogs/SignSignatureLineDialog.cxx
+++ b/cui/source/dialogs/SignSignatureLineDialog.cxx
@@ -165,8 +165,10 @@ IMPL_LINK_NOARG(SignSignatureLineDialog, 
chooseCertificate, weld::Button&, void)
     if (xSignCertificate.is())
     {
         m_xSelectedCertifate = xSignCertificate;
+        svl::crypto::CertificateOrName aCertificateOrName;
+        aCertificateOrName.m_xCertificate = xSignCertificate;
         m_xBtnChooseCertificate->set_label(
-            svx::SignatureLineHelper::getSignerName(xSignCertificate));
+            svx::SignatureLineHelper::getSignerName(aCertificateOrName));
     }
     ValidateFields();
 }
@@ -212,9 +214,11 @@ css::uno::Reference<css::graphic::XGraphic> 
SignSignatureLineDialog::getSignedGr
     aSvgImage = aSvgImage.replaceAll("[SIGNER_NAME]", 
getCDataString(m_aSuggestedSignerName));
     aSvgImage = aSvgImage.replaceAll("[SIGNER_TITLE]", 
getCDataString(m_aSuggestedSignerTitle));
 
+    svl::crypto::CertificateOrName aCertificateOrName;
+    aCertificateOrName.m_xCertificate = m_xSelectedCertifate;
     OUString aIssuerLine
         = CuiResId(RID_CUISTR_SIGNATURELINE_SIGNED_BY)
-              .replaceFirst("%1", 
svx::SignatureLineHelper::getSignerName(m_xSelectedCertifate));
+              .replaceFirst("%1", 
svx::SignatureLineHelper::getSignerName(aCertificateOrName));
     aSvgImage = aSvgImage.replaceAll("[SIGNED_BY]", 
getCDataString(aIssuerLine));
     if (bValid)
         aSvgImage = aSvgImage.replaceAll("[INVALID_SIGNATURE]", "");
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index c25a0164fe41..c0986b897a8d 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -4546,7 +4546,9 @@ static void 
doc_initializeForRendering(LibreOfficeKitDocument* pThis,
             uno::Reference<security::XCertificate> xCertificate = 
SfxLokHelper::getSigningCertificate(aSignatureCert, aSignatureKey);
             if (SfxViewShell* pViewShell = SfxViewShell::Current())
             {
-                pViewShell->SetSigningCertificate(xCertificate);
+                svl::crypto::CertificateOrName aCertificateOrName;
+                aCertificateOrName.m_xCertificate = xCertificate;
+                pViewShell->SetSigningCertificate(aCertificateOrName);
             }
         }
 
diff --git a/include/sfx2/viewsh.hxx b/include/sfx2/viewsh.hxx
index 76608d04ffcd..2ef2346d9ec4 100644
--- a/include/sfx2/viewsh.hxx
+++ b/include/sfx2/viewsh.hxx
@@ -76,6 +76,7 @@ namespace com::sun::star::view { class XRenderable; }
 namespace com::sun::star::security { class XCertificate; }
 namespace tools { class Rectangle; }
 namespace svtools { enum ColorConfigEntry : int; }
+namespace svl::crypto { class CertificateOrName; }
 
 enum class SfxPrinterChangeFlags
 {
@@ -496,8 +497,8 @@ public:
 
     OUString getA11yFocusedParagraph() const;
     int getA11yCaretPosition() const;
-    void SetSigningCertificate(const 
css::uno::Reference<css::security::XCertificate>& xCertificate);
-    css::uno::Reference<css::security::XCertificate> GetSigningCertificate() 
const;
+    void SetSigningCertificate(const svl::crypto::CertificateOrName& 
rCertificateOrName);
+    svl::crypto::CertificateOrName GetSigningCertificate() const;
 };
 
 #endif // INCLUDED_SFX2_VIEWSH_HXX
diff --git a/include/svl/cryptosign.hxx b/include/svl/cryptosign.hxx
index 8c8e48f0da54..291201cd394a 100644
--- a/include/svl/cryptosign.hxx
+++ b/include/svl/cryptosign.hxx
@@ -7,6 +7,8 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
+#pragma once
+
 #include <sal/types.h>
 
 #include <utility>
@@ -116,6 +118,17 @@ public:
     std::vector<unsigned char> m_aSignatureValue;
 };
 
+/// Used for visual signing: an XCertificate or a signer name.
+class SVL_DLLPUBLIC CertificateOrName
+{
+public:
+    /// If set, the certificate used for signing.
+    css::uno::Reference<css::security::XCertificate> m_xCertificate;
+    /// Otherwise we don't have a certificate but have a name to be featured 
on the visual
+    /// signature.
+    OUString m_aName;
+};
+
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/svx/signaturelinehelper.hxx 
b/include/svx/signaturelinehelper.hxx
index e8105a37bd7f..6f17f3726dd2 100644
--- a/include/svx/signaturelinehelper.hxx
+++ b/include/svx/signaturelinehelper.hxx
@@ -16,6 +16,7 @@
 
 #include <rtl/ustring.hxx>
 #include <svx/svxdllapi.h>
+#include <svl/cryptosign.hxx>
 
 #include <com/sun/star/graphic/XGraphic.hpp>
 #include <com/sun/star/security/XCertificate.hpp>
@@ -45,8 +46,7 @@ getSignatureCertificate(SfxObjectShell* pShell, SfxViewShell* 
pViewShell, weld::
 /**
  * Get a signer name out of a certificate.
  */
-SVX_DLLPUBLIC OUString
-getSignerName(const css::uno::Reference<css::security::XCertificate>& 
xCertificate);
+SVX_DLLPUBLIC OUString getSignerName(const svl::crypto::CertificateOrName& 
rCertificateOrName);
 
 /**
  * Gets a localized date string.
@@ -61,9 +61,8 @@ SVX_DLLPUBLIC css::uno::Reference<css::graphic::XGraphic> 
importSVG(std::u16stri
 /**
  * Sets xCertificate as the signing certificate of the selected shape on pView.
  */
-SVX_DLLPUBLIC void
-setShapeCertificate(const SdrView* pView,
-                    const css::uno::Reference<css::security::XCertificate>& 
xCertificate);
+SVX_DLLPUBLIC void setShapeCertificate(const SdrView* pView,
+                                       const svl::crypto::CertificateOrName& 
rCertificateOrName);
 }
 
 #endif
diff --git a/sd/qa/unit/tiledrendering/data/empty.pdf 
b/sd/qa/unit/tiledrendering/data/empty.pdf
new file mode 100644
index 000000000000..d6142103184b
Binary files /dev/null and b/sd/qa/unit/tiledrendering/data/empty.pdf differ
diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx 
b/sd/qa/unit/tiledrendering/tiledrendering.cxx
index e04340817fea..16501acfc346 100644
--- a/sd/qa/unit/tiledrendering/tiledrendering.cxx
+++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx
@@ -33,6 +33,7 @@
 #include <svl/stritem.hxx>
 #include <svl/intitem.hxx>
 #include <comphelper/lok.hxx>
+#include <comphelper/sequenceashashmap.hxx>
 #include <svx/unoapi.hxx>
 #include <svx/svdotable.hxx>
 #include <svx/svdoutl.hxx>
@@ -4759,6 +4760,33 @@ CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, 
testSlideshowLayeredRendering_Animati
     pXImpressDocument->postSlideshowCleanup();
 }
 
+CPPUNIT_TEST_FIXTURE(SdTiledRenderingTest, testInsertSignatureLineExternal)
+{
+    // Given a PDF to be signed:
+    uno::Sequence<beans::PropertyValue> aArgs = { 
comphelper::makePropertyValue("ReadOnly", true) };
+    loadWithParams(createFileURL(u"empty.pdf"), aArgs);
+    SdXImpressDocument* pImpressDocument = 
dynamic_cast<SdXImpressDocument*>(mxComponent.get());
+    sd::ViewShell* pViewShell = 
pImpressDocument->GetDocShell()->GetViewShell();
+    sd::View* pView = pViewShell->GetView();
+    pView->SetAuthor("myauthor");
+
+    // When insrerting a signature line for electronic (extrenal) signing:
+    aArgs = {
+        comphelper::makePropertyValue("External", true),
+    };
+    // Without the accompanying fix in place, this test would hang here in the 
certificate chooser
+    // dialog.
+    dispatchCommand(mxComponent, ".uno:InsertSignatureLine", aArgs);
+
+    // Then make sure the shape is marked as a signature line:
+    std::vector<SdrObject*> aMarkedObjects = pView->GetMarkedObjects();
+    CPPUNIT_ASSERT_EQUAL(static_cast<size_t>(1), aMarkedObjects.size());
+    uno::Any aAny;
+    aMarkedObjects[0]->GetGrabBagItem(aAny);
+    comphelper::SequenceAsHashMap aMap(aAny);
+    CPPUNIT_ASSERT(aMap.contains("SignatureCertificate"));
+}
+
 CPPUNIT_PLUGIN_IMPLEMENT();
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/func/fuconrec.cxx b/sd/source/ui/func/fuconrec.cxx
index fdf289408c38..a3e9c3665edb 100644
--- a/sd/source/ui/func/fuconrec.cxx
+++ b/sd/source/ui/func/fuconrec.cxx
@@ -512,16 +512,19 @@ void FuConstructRectangle::Deactivate()
         return;
     }
 
-    uno::Reference<security::XCertificate> xCertificate
-        = 
svx::SignatureLineHelper::getSignatureCertificate(mpViewShell->GetObjectShell(),
-                mpViewShell->GetViewShell(),
-                mpViewShell->GetFrameWeld());
-    if (!xCertificate.is())
+    svl::crypto::CertificateOrName aCertificateOrName = 
mpViewShell->GetViewShell()->GetSigningCertificate();
+    if (aCertificateOrName.m_aName.isEmpty())
     {
-        return;
+        aCertificateOrName.m_xCertificate = 
svx::SignatureLineHelper::getSignatureCertificate(
+            mpViewShell->GetObjectShell(), mpViewShell->GetViewShell(),
+            mpViewShell->GetFrameWeld());
+        if (!aCertificateOrName.m_xCertificate.is())
+        {
+            return;
+        }
     }
 
-    svx::SignatureLineHelper::setShapeCertificate(mpView, xCertificate);
+    svx::SignatureLineHelper::setShapeCertificate(mpView, aCertificateOrName);
 
     // Update infobar to offer "finish signing".
     SfxViewFrame* pFrame = mpViewShell->GetViewFrame();
diff --git a/sd/source/ui/view/drviewse.cxx b/sd/source/ui/view/drviewse.cxx
index 9defcffcdb34..242f75570503 100644
--- a/sd/source/ui/view/drviewse.cxx
+++ b/sd/source/ui/view/drviewse.cxx
@@ -61,6 +61,7 @@
 #include <sfx2/docfile.hxx>
 #include <sfx2/notebookbar/SfxNotebookBar.hxx>
 #include <osl/diagnose.h>
+#include <svl/cryptosign.hxx>
 
 #include <DrawViewShell.hxx>
 #include <slideshow.hxx>
@@ -469,18 +470,28 @@ void DrawViewShell::FuPermanent(SfxRequest& rReq)
                 {
                     aSignatureKey = pSignatureKey->GetValue().toUtf8();
                 }
+                bool bExternal = false;
+                const SfxBoolItem* pExternal = 
rReq.GetArg<SfxBoolItem>(FN_PARAM_3);
+                if (pExternal)
+                {
+                    bExternal = pExternal->GetValue();
+                }
 
                 SfxViewFrame* pFrame = GetFrame();
                 SfxViewShell* pViewShell = pFrame ? pFrame->GetViewShell() : 
nullptr;
                 if (pViewShell)
                 {
-                    uno::Reference<security::XCertificate> xSigningCertificate;
+                    svl::crypto::CertificateOrName aCertificateOrName;
                     if (!aSignatureCert.empty() && !aSignatureKey.empty())
                     {
-                        xSigningCertificate = 
SfxLokHelper::getSigningCertificate(aSignatureCert, aSignatureKey);
+                        aCertificateOrName.m_xCertificate = 
SfxLokHelper::getSigningCertificate(aSignatureCert, aSignatureKey);
+                    }
+                    else if (bExternal)
+                    {
+                        aCertificateOrName.m_aName = mpDrawView->GetAuthor();
                     }
                     // Always set the signing certificate, to clear data from 
a previous dispatch.
-                    pViewShell->SetSigningCertificate(xSigningCertificate);
+                    pViewShell->SetSigningCertificate(aCertificateOrName);
                 }
             }
 
diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx
index 3be01c98919d..d1b055711e0d 100644
--- a/sfx2/source/doc/objserv.cxx
+++ b/sfx2/source/doc/objserv.cxx
@@ -675,13 +675,13 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq)
                 SfxViewShell* pViewShell = pFrame ? pFrame->GetViewShell() : 
nullptr;
                 if (pViewShell)
                 {
-                    uno::Reference<security::XCertificate> xSigningCertificate;
+                    svl::crypto::CertificateOrName aCertificateOrName;
                     if (!aSignatureCert.empty() && !aSignatureKey.empty())
                     {
-                        xSigningCertificate = 
SfxLokHelper::getSigningCertificate(aSignatureCert, aSignatureKey);
+                        aCertificateOrName.m_xCertificate = 
SfxLokHelper::getSigningCertificate(aSignatureCert, aSignatureKey);
                     }
                     // Always set the signing certificate, to clear data from 
a previous dispatch.
-                    pViewShell->SetSigningCertificate(xSigningCertificate);
+                    pViewShell->SetSigningCertificate(aCertificateOrName);
                 }
 
                 // Async, all code before return has to go into the callback.
diff --git a/sfx2/source/view/viewimp.hxx b/sfx2/source/view/viewimp.hxx
index 1dc24eec7a82..83279ae84cee 100644
--- a/sfx2/source/view/viewimp.hxx
+++ b/sfx2/source/view/viewimp.hxx
@@ -28,6 +28,7 @@
 #include <svtools/acceleratorexecute.hxx>
 #include <rtl/ref.hxx>
 #include <vcl/print.hxx>
+#include <svl/cryptosign.hxx>
 #include <chrono>
 #include <vector>
 
@@ -59,7 +60,7 @@ struct SfxViewShell_Impl
     static sal_uInt32 m_nLastViewShellId;
     const ViewShellId m_nViewShellId;
     const ViewShellDocId m_nDocId;
-    css::uno::Reference<css::security::XCertificate> m_xSigningCertificate;
+    svl::crypto::CertificateOrName m_aSigningCertificate;
 
     explicit SfxViewShell_Impl(SfxViewShellFlags const nFlags, ViewShellDocId 
nDocId);
     ~SfxViewShell_Impl();
diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx
index 9e67b640b4c0..14096d5ce221 100644
--- a/sfx2/source/view/viewsh.cxx
+++ b/sfx2/source/view/viewsh.cxx
@@ -2812,14 +2812,14 @@ int SfxViewShell::getA11yCaretPosition() const
     return rDocFocusListener.getCaretPosition();
 }
 
-void SfxViewShell::SetSigningCertificate(const 
uno::Reference<security::XCertificate>& xCertificate)
+void SfxViewShell::SetSigningCertificate(const svl::crypto::CertificateOrName& 
rCertificate)
 {
-    pImpl->m_xSigningCertificate = xCertificate;
+    pImpl->m_aSigningCertificate = rCertificate;
 }
 
-uno::Reference<security::XCertificate> SfxViewShell::GetSigningCertificate() 
const
+svl::crypto::CertificateOrName SfxViewShell::GetSigningCertificate() const
 {
-    return pImpl->m_xSigningCertificate;
+    return pImpl->m_aSigningCertificate;
 }
 
 bool SfxViewShell::PrepareClose
diff --git a/svx/qa/unit/svdraw.cxx b/svx/qa/unit/svdraw.cxx
index 9b015e1a858f..767d8f8ca1d7 100644
--- a/svx/qa/unit/svdraw.cxx
+++ b/svx/qa/unit/svdraw.cxx
@@ -817,7 +817,9 @@ CPPUNIT_TEST_FIXTURE(SvdrawTest, testVisualSignResize)
         return;
     }
     SdrView* pView = SfxViewShell::Current()->GetDrawView();
-    svx::SignatureLineHelper::setShapeCertificate(pView, xCert);
+    svl::crypto::CertificateOrName aCertificateOrName;
+    aCertificateOrName.m_xCertificate = xCert;
+    svx::SignatureLineHelper::setShapeCertificate(pView, aCertificateOrName);
     pObjectShell->SetModified(false);
 
     // When resizing the shape by moving the bottom right (last) handle 
towards top right:
diff --git a/svx/sdi/svx.sdi b/svx/sdi/svx.sdi
index f682c37a5e50..a18ee9356364 100644
--- a/svx/sdi/svx.sdi
+++ b/svx/sdi/svx.sdi
@@ -12364,7 +12364,7 @@ SfxVoidItem AnchorMenu SID_ANCHOR_MENU
 ]
 
 SfxVoidItem InsertSignatureLine SID_INSERT_SIGNATURELINE
-(SfxStringItem SignatureCert FN_PARAM_1, SfxStringItem SignatureKey FN_PARAM_2)
+(SfxStringItem SignatureCert FN_PARAM_1, SfxStringItem SignatureKey 
FN_PARAM_2, SfxBoolItem External FN_PARAM_3)
 [
     AutoUpdate = FALSE,
     FastCall = FALSE,
diff --git a/svx/source/dialog/signaturelinehelper.cxx 
b/svx/source/dialog/signaturelinehelper.cxx
index c1d720a77794..61e26ac77bf1 100644
--- a/svx/source/dialog/signaturelinehelper.cxx
+++ b/svx/source/dialog/signaturelinehelper.cxx
@@ -99,10 +99,16 @@ getSignatureCertificate(SfxObjectShell* pShell, 
SfxViewShell* pViewShell, weld::
     return xSignCertificate;
 }
 
-OUString getSignerName(const css::uno::Reference<css::security::XCertificate>& 
xCertificate)
+OUString getSignerName(const svl::crypto::CertificateOrName& 
rCertificateOrName)
 {
-    return comphelper::xmlsec::GetContentPart(xCertificate->getSubjectName(),
-                                              
xCertificate->getCertificateKind());
+    if (rCertificateOrName.m_xCertificate.is())
+    {
+        return comphelper::xmlsec::GetContentPart(
+            rCertificateOrName.m_xCertificate->getSubjectName(),
+            rCertificateOrName.m_xCertificate->getCertificateKind());
+    }
+
+    return rCertificateOrName.m_aName;
 }
 
 OUString getLocalizedDate()
@@ -129,7 +135,7 @@ uno::Reference<graphic::XGraphic> 
importSVG(std::u16string_view rSVG)
 }
 
 void setShapeCertificate(const SdrView* pView,
-                         const 
css::uno::Reference<css::security::XCertificate>& xCertificate)
+                         const svl::crypto::CertificateOrName& 
rCertificateOrName)
 {
     const SdrMarkList& rMarkList = pView->GetMarkedObjectList();
     if (rMarkList.GetMarkCount() < 1)
@@ -148,13 +154,20 @@ void setShapeCertificate(const SdrView* pView,
     uno::Reference<drawing::XShape> xShape = pSignatureLine->getUnoShape();
     uno::Reference<beans::XPropertySet> xShapeProps(xShape, uno::UNO_QUERY);
     comphelper::SequenceAsHashMap 
aMap(xShapeProps->getPropertyValue("InteropGrabBag"));
-    aMap["SignatureCertificate"] <<= xCertificate;
+    if (rCertificateOrName.m_xCertificate.is())
+    {
+        aMap["SignatureCertificate"] <<= rCertificateOrName.m_xCertificate;
+    }
+    else
+    {
+        aMap["SignatureCertificate"] <<= rCertificateOrName.m_aName;
+    }
     xShapeProps->setPropertyValue("InteropGrabBag", 
uno::Any(aMap.getAsConstPropertyValueList()));
 
     // Read svg and replace placeholder texts.
     OUString 
aSvgImage(svx::SignatureLineHelper::getSignatureImage("signature-line-draw.svg"));
     aSvgImage = aSvgImage.replaceAll("[SIGNED_BY]", 
SvxResId(RID_SVXSTR_SIGNATURELINE_DSIGNED_BY));
-    OUString aSignerName = 
svx::SignatureLineHelper::getSignerName(xCertificate);
+    OUString aSignerName = 
svx::SignatureLineHelper::getSignerName(rCertificateOrName);
     aSvgImage = aSvgImage.replaceAll("[SIGNER_NAME]", aSignerName);
     OUString aDate = svx::SignatureLineHelper::getLocalizedDate();
     aDate = SvxResId(RID_SVXSTR_SIGNATURELINE_DATE).replaceFirst("%1", aDate);
diff --git a/vcl/qa/cppunit/filter/ipdf/ipdf.cxx 
b/vcl/qa/cppunit/filter/ipdf/ipdf.cxx
index 14ac21c27c8b..96c64c453a1b 100644
--- a/vcl/qa/cppunit/filter/ipdf/ipdf.cxx
+++ b/vcl/qa/cppunit/filter/ipdf/ipdf.cxx
@@ -101,7 +101,9 @@ CPPUNIT_TEST_FIXTURE(VclFilterIpdfTest, 
testPDFAddVisibleSignatureLastPage)
         return;
     }
     SdrView* pView = SfxViewShell::Current()->GetDrawView();
-    svx::SignatureLineHelper::setShapeCertificate(pView, xCert);
+    svl::crypto::CertificateOrName aCertificateOrName;
+    aCertificateOrName.m_xCertificate = xCert;
+    svx::SignatureLineHelper::setShapeCertificate(pView, aCertificateOrName);
 
     // the document is modified now, but Sign function can't show SaveAs dialog
     // in unit test, so just clear the modified
diff --git a/xmlsecurity/qa/unit/signing/signing.cxx 
b/xmlsecurity/qa/unit/signing/signing.cxx
index f2c6ddcfa714..ac03236396ed 100644
--- a/xmlsecurity/qa/unit/signing/signing.cxx
+++ b/xmlsecurity/qa/unit/signing/signing.cxx
@@ -770,7 +770,9 @@ CPPUNIT_TEST_FIXTURE(SigningTest, 
testPDFAddVisibleSignature)
         return;
     }
     SdrView* pView = SfxViewShell::Current()->GetDrawView();
-    svx::SignatureLineHelper::setShapeCertificate(pView, aCertificates[0]);
+    svl::crypto::CertificateOrName aCertificateOrName;
+    aCertificateOrName.m_xCertificate = aCertificates[0];
+    svx::SignatureLineHelper::setShapeCertificate(pView, aCertificateOrName);
 
     // the document is modified now, but Sign function can't show SaveAs dialog
     // in unit test, so just clear the modified
diff --git a/xmlsecurity/source/dialogs/certificatechooser.cxx 
b/xmlsecurity/source/dialogs/certificatechooser.cxx
index 19e08399bd66..b319571528e9 100644
--- a/xmlsecurity/source/dialogs/certificatechooser.cxx
+++ b/xmlsecurity/source/dialogs/certificatechooser.cxx
@@ -26,6 +26,7 @@
 #include <comphelper/xmlsechelper.hxx>
 #include <comphelper/lok.hxx>
 #include <sfx2/viewsh.hxx>
+#include <svl/cryptosign.hxx>
 
 #include <com/sun/star/security/NoPasswordException.hpp>
 #include <com/sun/star/security/CertificateCharacters.hpp>
@@ -215,9 +216,9 @@ void CertificateChooser::ImplInitialize(bool mbSearch)
                     if (comphelper::LibreOfficeKit::isActive())
                     {
                         // The LOK case takes the signing certificate from the 
view.
-                        if (m_pViewShell && 
m_pViewShell->GetSigningCertificate().is())
+                        if (m_pViewShell && 
m_pViewShell->GetSigningCertificate().m_xCertificate.is())
                         {
-                            xCerts = { m_pViewShell->GetSigningCertificate() };
+                            xCerts = { 
m_pViewShell->GetSigningCertificate().m_xCertificate };
                         }
                     }
                     else
diff --git a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx 
b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
index 1d613b5576d0..ddf878598add 100644
--- a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
+++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx
@@ -311,7 +311,7 @@ DigitalSignaturesDialog::DigitalSignaturesDialog(
     if (comphelper::LibreOfficeKit::isActive())
     {
         // If the view has a signing certificate, then allow adding a 
signature.
-        if (!pViewShell || !pViewShell->GetSigningCertificate().is())
+        if (!pViewShell || 
!pViewShell->GetSigningCertificate().m_xCertificate.is())
         {
             m_xAddBtn->hide();
         }

Reply via email to