summaryrefslogtreecommitdiff
path: root/xmlsecurity/inc/certificatechooser.hxx
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2024-09-27 08:12:04 +0200
committerMiklos Vajna <vmiklos@collabora.com>2024-09-27 10:01:30 +0200
commita581dbf9829d8407a611907c35c8af632b1397b5 (patch)
tree85fdab6fb9b286098619269d9b66b210f4c7b8a7 /xmlsecurity/inc/certificatechooser.hxx
parent522d2aaf1ca830bcf3bca816b06cc8faa893cd0d (diff)
cool#9992 lok doc sign: only take sign cert from the view in the cert chooser
Have two views, in case both of them haver sign certs configured in the NSS database, then the cert chooser would present both, which is not wanted. The problem is that the NSS database contains sign certs from all views, so working from the database is not what we want for the LOK case. Fix the problem by passing the SfxViewShell from the sign dialog to the certificate chooser dialog, and then the chooser can work from the view in LOK mode. Searching for other uses of getPersonalCertificates(), the comphelper/ one is not relevant for the LOK case (gpg is disabled there); the PDF case is only for the UNO API, so those don't necessarily need adjusting. Change-Id: Ic7027b8d218b2bde3c8bf134a4b11c14fd9c3570 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174002 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'xmlsecurity/inc/certificatechooser.hxx')
-rw-r--r--xmlsecurity/inc/certificatechooser.hxx7
1 files changed, 6 insertions, 1 deletions
diff --git a/xmlsecurity/inc/certificatechooser.hxx b/xmlsecurity/inc/certificatechooser.hxx
index 9f7b2e2407d5..dbed2ce5c225 100644
--- a/xmlsecurity/inc/certificatechooser.hxx
+++ b/xmlsecurity/inc/certificatechooser.hxx
@@ -33,6 +33,8 @@ namespace com::sun::star {
namespace com::sun::star::xml::crypto { class XXMLSecurityContext; }
+class SfxViewShell;
+
struct CertificateChooserUserData
{
css::uno::Reference<css::security::XCertificate> xCertificate;
@@ -55,6 +57,7 @@ private:
bool mbInitialized;
CertificateChooserUserAction const meAction;
+ SfxViewShell* m_pViewShell;
OUString msPreferredKey;
css::uno::Reference<css::security::XCertificate> mxEncryptToSelf;
@@ -85,11 +88,13 @@ private:
public:
CertificateChooser(weld::Window* pParent,
+ SfxViewShell* pViewShell,
std::vector< css::uno::Reference< css::xml::crypto::XXMLSecurityContext > > && rxSecurityContexts,
CertificateChooserUserAction eAction);
virtual ~CertificateChooser() override;
static std::unique_ptr<CertificateChooser> getInstance(weld::Window* _pParent,
+ SfxViewShell* pViewShell,
std::vector< css::uno::Reference< css::xml::crypto::XXMLSecurityContext > > && rxSecurityContexts,
CertificateChooserUserAction eAction) {
// Don't reuse CertificateChooser instances
@@ -100,7 +105,7 @@ public:
// in the Digital Signatures dialog
// 2. File > Save As the document, check the "Encrypt with GPG key"
// checkbox, press Encrypt, and crash in Dialog::ImplStartExecute()
- return std::make_unique<CertificateChooser>(_pParent, std::move(rxSecurityContexts), eAction);
+ return std::make_unique<CertificateChooser>(_pParent, pViewShell, std::move(rxSecurityContexts), eAction);
}
short run() override;