From a69873d212c903ea8a1f0d5ca40ae3f08b83a871 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Tue, 8 Nov 2016 14:10:05 +0100 Subject: xmlsecurity: move the sec context from the format helpers to the sign manager The signature manager always creates an XML helper, and optionally creates a PDF helper as well. Both of them initialize xmlsec, and when the signature manager is deleted, there are two de-inits, leading to an assertion failure in xmlsec. Fix the problem by moving the duplicated xmlsec init to the signature manager. This has the additional benefit that general security-related code no longer has to talk to the XML helper, it can use the signature manager, which feels more natural. (What viewing a certificate had to do with XML?) Change-Id: If6a6bc433636445f3782849a367d4a7ac0be7688 Reviewed-on: https://gerrit.libreoffice.org/30695 Reviewed-by: Miklos Vajna Tested-by: Jenkins --- xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'xmlsecurity/source/dialogs') diff --git a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx index 5d8ab1d38849..19ea5d04d2b3 100644 --- a/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx +++ b/xmlsecurity/source/dialogs/digitalsignaturesdialog.cxx @@ -212,7 +212,7 @@ void DigitalSignaturesDialog::dispose() bool DigitalSignaturesDialog::Init() { - bool bInit = maSignatureManager.maSignatureHelper.Init(); + bool bInit = maSignatureManager.init(); SAL_WARN_IF( !bInit, "xmlsecurity.dialogs", "Error initializing security context!" ); @@ -384,7 +384,7 @@ IMPL_LINK_NOARG(DigitalSignaturesDialog, AddButtonHdl, Button*, void) return; try { - uno::Reference xSecEnv = maSignatureManager.maSignatureHelper.GetSecurityEnvironment(); + uno::Reference xSecEnv = maSignatureManager.getSecurityEnvironment(); ScopedVclPtrInstance< CertificateChooser > aChooser( this, mxCtx, xSecEnv ); if ( aChooser->Execute() == RET_OK ) @@ -457,7 +457,7 @@ void DigitalSignaturesDialog::ImplFillSignaturesBox() { m_pSignaturesLB->Clear(); - uno::Reference< css::xml::crypto::XSecurityEnvironment > xSecEnv = maSignatureManager.maSignatureHelper.GetSecurityEnvironment(); + uno::Reference xSecEnv = maSignatureManager.getSecurityEnvironment(); uno::Reference xSerialNumberAdapter = css::security::SerialNumberAdapter::create(mxCtx); @@ -618,8 +618,7 @@ void DigitalSignaturesDialog::ImplShowSignaturesDetails() { sal_uInt16 nSelected = (sal_uInt16) reinterpret_cast( m_pSignaturesLB->FirstSelected()->GetUserData() ); const SignatureInformation& rInfo = maSignatureManager.maCurrentSignatureInformations[ nSelected ]; - css::uno::Reference xSecEnv = - maSignatureManager.maSignatureHelper.GetSecurityEnvironment(); + uno::Reference xSecEnv = maSignatureManager.getSecurityEnvironment(); css::uno::Reference xSerialNumberAdapter = css::security::SerialNumberAdapter::create(mxCtx); // Use Certificate from doc, not from key store @@ -633,7 +632,7 @@ void DigitalSignaturesDialog::ImplShowSignaturesDetails() SAL_WARN_IF( !xCert.is(), "xmlsecurity.dialogs", "Error getting Certificate!" ); if ( xCert.is() ) { - ScopedVclPtrInstance< CertificateViewer > aViewer( this, maSignatureManager.maSignatureHelper.GetSecurityEnvironment(), xCert, false ); + ScopedVclPtrInstance aViewer(this, maSignatureManager.getSecurityEnvironment(), xCert, false); aViewer->Execute(); } } -- cgit